Example #1
0
        private static Feature loadFeature(XmlNode featureNode, Charakter charakter, int number, DSA_FEATURES type)
        {
            Feature feature = new Feature(type);

            foreach (XmlNode node in featureNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Name: feature.setName(node.InnerText); break;

                case ManagmentXMLStrings.Description: feature.setDescription(node.InnerText); break;

                case ManagmentXMLStrings.Value: feature.setValue(node.InnerText); break;

                case ManagmentXMLStrings.GP: feature.setGP(node.InnerText); break;

                case ManagmentXMLStrings.AttributeElement: LoadAttribute(node, feature); break;

                case ManagmentXMLStrings.EnergienElement: LoadEnergien(node, feature); break;

                case ManagmentXMLStrings.AdvancedElement: LoadFeatureAdvanced(node, feature); break;

                case ManagmentXMLStrings.Talente: LoadFeatureTalente(node, charakter, feature); break;
                }
            }

            return(feature);
        }
Example #2
0
        private static void LoadFeatureTalente(XmlNode talentNode, Charakter charakter, Feature feature)
        {
            List <InterfaceTalent> listTalente = charakter.getAllTalentList();

            foreach (XmlNode innerTalent in talentNode)
            {
                InterfaceTalent talent   = null;
                String          name     = "";
                String          TaWBonus = "";

                foreach (XmlNode node in innerTalent)
                {
                    switch (node.Name)
                    {
                    case ManagmentXMLStrings.Name: name = node.InnerText; break;

                    case ManagmentXMLStrings.TAW: TaWBonus = node.InnerText; break;
                    }
                }
                talent = charakter.getTalent(name);


                int x = 0;
                Int32.TryParse(TaWBonus, out x);

                if (talent == null)
                {
                    throw new Exception("Talent darf nicht null sein");
                }

                feature.addTalent(talent, x);
            }
        }
Example #3
0
        private static void LoadFeatureTalente(XmlNode talentNode, Charakter charakter, Feature feature)
        {
            List <InterfaceTalent> listTalente = charakter.getTalentList_allTalents();

            foreach (XmlNode innerTalent in talentNode)
            {
                InterfaceTalent talent   = null;
                String          name     = "";
                String          TaWBonus = "";

                foreach (XmlNode node in innerTalent)
                {
                    switch (node.Name)
                    {
                    case ManagmentXMLStrings.Name: name = node.InnerText; break;

                    case ManagmentXMLStrings.TAW: TaWBonus = node.InnerText; break;
                    }
                }
                talent = charakter.getTalent(name);


                int x = 0;
                Int32.TryParse(TaWBonus, out x);

                if (talent == null)
                {
                    Exception e = new ArgumentNullException("Das Talent " + name + " exestiert nicht, wurde aber versucht in dem Feature " + feature.getName() + " zu laden");
                    Log.throwError(e);
                    throw e;
                }

                feature.addTalent(talent, x);
            }
        }
Example #4
0
        private static void loadAttribute(XmlNode AttributeNode, Charakter charakter)
        {
            String[] name   = Enum.GetNames(typeof(DSA_ATTRIBUTE));
            int      length = Enum.GetNames(typeof(DSA_ATTRIBUTE)).Length;

            foreach (XmlNode typeNode in AttributeNode)
            {
                for (int i = 0; i < length; i++)
                {
                    if (String.Compare(typeNode.Name, name[i]) == 0)
                    {
                        foreach (XmlNode node in typeNode)
                        {
                            switch (node.Name)
                            {
                            case ManagmentXMLStrings.Value:
                                int x;
                                Int32.TryParse(node.InnerText, out x);
                                charakter.setAttribute((DSA_ATTRIBUTE)i, x);
                                break;

                            case ManagmentXMLStrings.Marked:
                                if (0 == String.Compare(true.ToString(), node.InnerText))
                                {
                                    charakter.setMarkedAttribut((DSA_ATTRIBUTE)i, true);
                                }
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }
Example #5
0
        private Charakter createNewCharater()
        {
            Charakter charakter = new Charakter();

            String path;

            path = Path.Combine(ManagmentSaveStrings.currentDirectory, rootPath);
            path = Path.Combine(path, ManagmentSaveStrings.SaveLocation);

            controllTalent = new ControllTalent(getResourcePath());
            charakter.addTalent(controllTalent.getTalentList <TalentClose>());
            charakter.addTalent(controllTalent.getTalentList <TalentRange>());
            charakter.addTalent(controllTalent.getTalentList <TalentWeaponless>());

            charakter.addTalent(controllTalent.getTalentList <TalentCrafting>());
            charakter.addTalent(controllTalent.getTalentList <TalentKnwoldage>());
            charakter.addTalent(controllTalent.getTalentList <TalentNature>());
            charakter.addTalent(controllTalent.getTalentList <TalentPhysical>());
            charakter.addTalent(controllTalent.getTalentList <TalentSocial>());

            charakter.addTalent(controllTalent.getTalentList <LanguageTalent>());
            charakter.addTalent(controllTalent.getTalentList <FontTalent>());

            controllLanguageFamily = new ControllLanguageFamily(charakter, getResourcePath());

            return(charakter);
        }
Example #6
0
        private static void loadAdvanturePoints(XmlNode AdvanturePoints, Charakter charakter)
        {
            int x;

            Int32.TryParse(AdvanturePoints.InnerText, out x);
            charakter.setAdventurePoints(x);
        }
Example #7
0
 public int getProbeValuePA()
 {
     if (Charakter == null)
     {
         return(0);
     }
     return(Charakter.getAdvancedValueMAX(Probe[1]) + PA);
 }
Example #8
0
 public int getProbeValueAT()
 {
     if (Charakter == null)
     {
         return(0);
     }
     return(Charakter.getAdvancedValueMAX(Probe[0]) + AT);
 }
Example #9
0
 private static void loadTalentVersion1(XmlNode TalentNode, Charakter charakter)
 {
     foreach (XmlNode CatecorieNode in TalentNode)
     {
         foreach (XmlNode Talent in CatecorieNode)
         {
             loadTalentNode(Talent, charakter);
         }
     }
 }
Example #10
0
        private static void saveMoney(Charakter charakter, XmlDocument characterFile, XmlElement element)
        {
            String[] names  = Enum.GetNames(typeof(DSA_MONEY));
            int      length = Enum.GetNames(typeof(DSA_MONEY)).Length;

            for (int i = 0; i < length; i++)
            {
                element.AppendChild(characterFile.CreateElement(names[i])).InnerText = charakter.getMoney((DSA_MONEY)i).ToString();
            }
        }
Example #11
0
        private static void saveAdvancedValues(Charakter charakter, XmlDocument characterFile, XmlElement element)
        {
            String[] names  = Enum.GetNames(typeof(DSA_ADVANCEDVALUES));
            int      length = Enum.GetNames(typeof(DSA_ADVANCEDVALUES)).Length;

            for (int i = 0; i < length; i++)
            {
                element.AppendChild(characterFile.CreateElement(names[i])).InnerText = charakter.getAdvancedValueAKT((DSA_ADVANCEDVALUES)i).ToString();
            }
        }
Example #12
0
        public static void saveCharakter(Charakter charakter, string fileName)
        {
            XmlDocument characterFile         = new XmlDocument();
            XmlElement  SaveFile              = characterFile.CreateElement(ManagmentXMLStrings.SaveFile);
            XmlElement  Version               = characterFile.CreateElement(ManagmentXMLStrings.Version);
            XmlElement  CharakterBogenElement = characterFile.CreateElement(ManagmentXMLStrings.CharacterBogenElement);
            XmlElement  HeldenBriefElement    = characterFile.CreateElement(ManagmentXMLStrings.HeldenBriefElement);
            XmlElement  BasisDatenElement     = characterFile.CreateElement(ManagmentXMLStrings.BasisDatenElement);
            XmlElement  AttributeElement      = characterFile.CreateElement(ManagmentXMLStrings.AttributeElement);
            XmlElement  AdvancedValue         = characterFile.CreateElement(ManagmentXMLStrings.AdvancedElement);
            XmlElement  MoneyElement          = characterFile.CreateElement(ManagmentXMLStrings.MoneyElement);
            XmlElement  FeatureElement        = characterFile.CreateElement(ManagmentXMLStrings.FeatureElement);
            XmlElement  AdvantageElement      = characterFile.CreateElement(ManagmentXMLStrings.Advantages);
            XmlElement  DisAdvantageElement   = characterFile.CreateElement(ManagmentXMLStrings.DisAdvantages);
            XmlElement  TalentBriefElement    = characterFile.CreateElement(ManagmentXMLStrings.TalentBriefElement);
            XmlElement  AdvanturePoints       = characterFile.CreateElement(ManagmentXMLStrings.AdvanturePoints);


            saveBasisDaten(charakter, characterFile, BasisDatenElement);
            saveAttribute(charakter, characterFile, AttributeElement);
            saveAdvancedValues(charakter, characterFile, AdvancedValue);
            saveMoney(charakter, characterFile, MoneyElement);
            saveFeature(charakter, characterFile, AdvantageElement, DSA_FEATURES.VORTEIL);
            saveFeature(charakter, characterFile, DisAdvantageElement, DSA_FEATURES.NACHTEIL);
            saveTalents(charakter, characterFile, TalentBriefElement);
            saveAdventurePoints(charakter, AdvanturePoints);

            characterFile.AppendChild(SaveFile);
            SaveFile.AppendChild(Version).InnerText = ManagmentXMLStrings.VersionsNumber;
            SaveFile.AppendChild(CharakterBogenElement);
            CharakterBogenElement.AppendChild(HeldenBriefElement);
            HeldenBriefElement.AppendChild(BasisDatenElement);
            HeldenBriefElement.AppendChild(AttributeElement);
            HeldenBriefElement.AppendChild(AdvancedValue);
            HeldenBriefElement.AppendChild(MoneyElement);
            HeldenBriefElement.AppendChild(FeatureElement);
            HeldenBriefElement.AppendChild(AdvanturePoints);

            FeatureElement.AppendChild(AdvantageElement);
            FeatureElement.AppendChild(DisAdvantageElement);


            CharakterBogenElement.AppendChild(TalentBriefElement);


            /*Dateiendung XML?*/
            string fileEndung = fileName.Substring(fileName.Length - 4);

            if (fileEndung != ".xml")
            {
                fileName = fileName + ".xml";
            }
            characterFile.Save(fileName);
        }
Example #13
0
        private static void loadFeature(XmlNode featureNode, Charakter charakter)
        {
            foreach (XmlNode node in featureNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Advantages: loadFeature(node, charakter, DSA_FEATURES.VORTEIL); break;

                case ManagmentXMLStrings.DisAdvantages: loadFeature(node, charakter, DSA_FEATURES.NACHTEIL); break;
                }
            }
        }
        public LanguageFamily loadFile(String fileName, Charakter charakter)
        {
            clear();
            this.charakter = charakter;
            this.FileName  = fileName;
            if (!TestIFxmlFile(fileName))
            {
                return(null);
            }

            load(fileName);
            return(LanguageFamily);
        }
Example #15
0
 private static void saveFeature(Charakter charakter, XmlDocument characterFile, XmlElement element, DSA_FEATURES type)
 {
     for (int i = 0; i <= charakter.getHighistFeatureNumber(); i++)
     {
         Feature feature = charakter.getFeature(type, i);
         if (feature != null)
         {
             XmlElement newFeature = characterFile.CreateElement(ManagmentXMLStrings.Number + i.ToString());
             saveFeature(feature, characterFile, newFeature);
             element.AppendChild(newFeature);
         }
     }
 }
Example #16
0
        public void load()
        {
            String path = Path.Combine(getResourcePath(), ManagmentSaveStrings.SaveLocation);

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = path;
            openFileDialog.Filter           = "xmlFiles |*xml";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Charakter = LoadCharakterXML.loadCharakter(openFileDialog.FileName, createNewCharater(), controllTalent);
            }
        }
Example #17
0
        //########################################################################################################################
        //HeroPage
        private static void saveBasisDaten(Charakter charakter, XmlDocument characterFile, XmlElement element)
        {
            String[] names  = Enum.GetNames(typeof(DSA_BASICVALUES));
            int      length = Enum.GetNames(typeof(DSA_BASICVALUES)).Length;

            for (int i = 0; i < length; i++)
            {
                String innerText = charakter.getBasicValue((DSA_BASICVALUES)i).ToString();
                if (innerText != "" && innerText != null)
                {
                    element.AppendChild(characterFile.CreateElement(names[i])).InnerText = innerText;
                }
            }
        }
Example #18
0
 private static void loadTalentVersion2(XmlNode TalentNode, Charakter charakter)
 {
     try
     {
         foreach (XmlNode Talent in TalentNode)
         {
             loadTalentNode(Talent, charakter);
         }
     } catch (Exception e)
     {
         Console.WriteLine(e.Message);
         loadTalentVersion1(TalentNode, charakter);
     }
 }
Example #19
0
        private static void loadTalentbrief(XmlNode TalentNode, Charakter charakter)
        {
            foreach (XmlNode TalentType in TalentNode)
            {
                switch (TalentType.Name)
                {
                case (ManagmentXMLStrings.GeneralTalent): loadTalent_(TalentType, charakter); break;

                case (ManagmentXMLStrings.FightingTalent): loadTalent_(TalentType, charakter); break;

                case (ManagmentXMLStrings.Language): loadTalentLanguage(TalentType, charakter); break;
                }
            }
        }
Example #20
0
        public override String getProbeStringOne()
        {
            if (learned == false)
            {
                return("-");
            }

            int ret = 0;

            for (int i = 0; i < getProbeCount(); i++)
            {
                ret = ret + Charakter.getAttribute_Max(Probe[i]) + getTawWithBonus();
            }
            return(ret.ToString());
        }
Example #21
0
        public static Charakter loadCharakter(String fileName, Charakter charakter)
        {
            XmlDocument characterFile = new XmlDocument();

            characterFile.Load(fileName);

            XmlNode characterNode   = characterFile.SelectSingleNode("/" + ManagmentXMLStrings.CharacterBogenElement);
            XmlNode heldenbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.HeldenBriefElement);
            XmlNode talentbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.TalentBriefElement);

            loadHeldenbrief(heldenbriefNode, charakter);
            loadTalentbrief(talentbriefNode, charakter);

            return(charakter);
        }
Example #22
0
        private static void loadBasicData(XmlNode BasicDataNode, Charakter charakter)
        {
            String[] name   = Enum.GetNames(typeof(DSA_BASICVALUES));
            int      length = Enum.GetNames(typeof(DSA_BASICVALUES)).Length;

            for (int i = 0; i < length; i++)
            {
                foreach (XmlNode node in BasicDataNode)
                {
                    if ((node.Name).ToUpper() == name[i].ToUpper())
                    {
                        charakter.setBasicValues((DSA_BASICVALUES)i, node.InnerText);
                    }
                }
            }
        }
Example #23
0
        private static void loadTalent(XmlNode TalentNode, Charakter charakter)
        {
            String Name = null;
            String Taw  = null;
            String AT   = null;
            String PA   = null;

            foreach (XmlNode node in TalentNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Name: Name = node.InnerText; break;

                case ManagmentXMLStrings.TAW: Taw = node.InnerText; break;

                case ManagmentXMLStrings.attack: AT = node.InnerText; break;

                case ManagmentXMLStrings.Parade: PA = node.InnerText; break;

                default: throw new Exception();
                }
            }

            Name = Name.Replace(".", " ");

            InterfaceTalent talent = charakter.getTalent(Name);

            if (talent == null)
            {
                return;
            }
            talent.setTaw(Taw);

            if (AT != null & PA != null)
            {
                TalentFighting ftalent = (TalentFighting)talent;

                int x = 0;

                Int32.TryParse(AT, out x);
                ftalent.setAT(x);

                Int32.TryParse(PA, out x);
                ftalent.setPA(x);
            }
        }
Example #24
0
        private static void loadMoney(XmlNode MoneyNode, Charakter charakter)
        {
            String[] name   = Enum.GetNames(typeof(DSA_MONEY));
            int      length = Enum.GetNames(typeof(DSA_MONEY)).Length;

            for (int i = 0; i < length; i++)
            {
                foreach (XmlNode node in MoneyNode)
                {
                    if ((node.Name).ToUpper() == name[i].ToUpper())
                    {
                        int x;
                        Int32.TryParse(node.InnerText, out x);
                        charakter.setMoney((DSA_MONEY)i, x);
                    }
                }
            }
        }
Example #25
0
        private static void loadAdvanced(XmlNode advancedNode, Charakter charakter)
        {
            String[] name   = Enum.GetNames(typeof(DSA_ADVANCEDVALUES));
            int      length = Enum.GetNames(typeof(DSA_ADVANCEDVALUES)).Length;

            for (int i = 0; i < length; i++)
            {
                foreach (XmlNode node in advancedNode)
                {
                    if ((node.Name).ToUpper() == name[i].ToUpper())
                    {
                        int x;
                        Int32.TryParse(node.InnerText, out x);
                        charakter.setAdvancedValueAKT((DSA_ADVANCEDVALUES)i, x);
                    }
                }
            }
        }
Example #26
0
        public static Charakter loadCharakter(String fileName, Charakter charakter, ControllTalent Tcontroller)
        {
            XmlDocument characterFile   = new XmlDocument();
            XmlNode     saveFile        = null;
            XmlNode     characterNode   = null;
            XmlNode     heldenbriefNode = null;
            XmlNode     talentbriefNode = null;

            comments  = new List <String>();
            tControll = Tcontroller;

            characterFile.Load(fileName);

            try
            {
                //Load Current Save Version -> Version2
                saveFile        = characterFile.SelectSingleNode("/" + ManagmentXMLStrings.SaveFile);
                characterNode   = saveFile.SelectSingleNode(ManagmentXMLStrings.CharacterBogenElement);
                heldenbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.HeldenBriefElement);
                talentbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.TalentBriefElement);
            }
            catch
            {
                //Try to Load old Save Version -> Version1
                characterNode   = characterFile.SelectSingleNode("/" + ManagmentXMLStrings.CharacterBogenElement);
                heldenbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.HeldenBriefElement);
                talentbriefNode = characterNode.SelectSingleNode(ManagmentXMLStrings.TalentBriefElement);
            }
            finally
            {
                if (characterNode == null || heldenbriefNode == null || talentbriefNode == null)
                {
                    Exception e = new Exception("This file is not Supported");
                    Log.throwError(e);
                    throw e;
                }
            }

            loadHeldenbrief(heldenbriefNode, charakter);
            loadTalentbrief(talentbriefNode, charakter);

            return(charakter);
        }
Example #27
0
        private static void loadHeldenbrief(XmlNode HeldenbriefNode, Charakter charakter)
        {
            foreach (XmlNode node in HeldenbriefNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.BasisDatenElement: loadBasicData(node, charakter); break;

                case ManagmentXMLStrings.AttributeElement:  loadAttribute(node, charakter); break;

                case ManagmentXMLStrings.AdvancedElement:   loadAdvanced(node, charakter); break;

                case ManagmentXMLStrings.MoneyElement:      loadMoney(node, charakter); break;

                case ManagmentXMLStrings.FeatureElement:    loadFeature(node, charakter); break;

                case ManagmentXMLStrings.AdvanturePoints:   loadAdvanturePoints(node, charakter); break;
                }
            }
        }
Example #28
0
        public ControllLanguageFamily(Charakter charakter, String ResourcePath)
        {
            this.charakter = charakter;
            LoadFile_LanguageFamily loader = new LoadFile_LanguageFamily();

            list = new List <LanguageFamily>(0);

            LanguageTalentFileSystemLocation = Path.Combine(ResourcePath, ManagmentSaveStrings.LanguageTalentFileSystemLocation);
            LanguageTalentFileSystemLocation = Path.Combine(LanguageTalentFileSystemLocation, "LanguageFamily");

            String[] files = Directory.GetFiles(LanguageTalentFileSystemLocation);

            for (int i = 0; i < files.Length; i++)
            {
                LanguageFamily family = loader.loadFile(files[i], charakter);
                if (family != null)
                {
                    list.Add(family);
                }
            }
        }
Example #29
0
        private static void loadFeature(XmlNode featureNode, Charakter charakter, DSA_FEATURES type)
        {
            int    i           = 0;
            String BasicString = "Number";

            foreach (XmlNode node in featureNode)
            {
                i++;
                Feature feature = loadFeature(node, charakter, i, type);
                feature.setType(type);

                int    number = 0;
                String Number = node.Name.Substring(BasicString.Length, node.Name.Length - BasicString.Length);

                if (!Int32.TryParse(Number, out number))
                {
                    throw new Exception();
                }
                charakter.addFeature(type, number, feature);
            }
        }
Example #30
0
        private static void saveAttribute(Charakter charakter, XmlDocument characterFile, XmlElement element)
        {
            String[] names  = Enum.GetNames(typeof(DSA_ATTRIBUTE));
            int      length = Enum.GetNames(typeof(DSA_ATTRIBUTE)).Length;

            for (int i = 0; i < length; i++)
            {
                XmlElement type   = characterFile.CreateElement(names[i]);
                XmlElement value  = characterFile.CreateElement(ManagmentXMLStrings.Value);
                XmlElement marked = characterFile.CreateElement(ManagmentXMLStrings.Marked);

                value.InnerText = charakter.getAttributeAKT((DSA_ATTRIBUTE)i).ToString();

                if (charakter.getMarkedAttribut((DSA_ATTRIBUTE)i))
                {
                    marked.InnerText = true.ToString();
                    type.AppendChild(marked);
                }
                type.AppendChild(value);
                element.AppendChild(type);
            }
        }