Exemplo n.º 1
0
        private static void loadTalentNode(XmlNode TalentNode, Charakter charakter)
        {
            String Name           = null;
            String Taw            = null;
            String AT             = null;
            String PA             = null;
            String speakingMother = 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;

                case ManagmentXMLStrings.SpeakingMother: speakingMother = node.InnerText; break;

                default: throw new Exception(node.Name + " " + node.InnerText);
                }
            }
            if (Name == null)
            {
                Exception e = new MissingMemberException("Corrput File. Talent Without Name");
                Log.throwError(e);
                throw e;
            }

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

            InterfaceTalent talent = charakter.getTalent(Name);

            if (talent == null)
            {
                talent = tControll.getTalent(Name);
                if (talent == null)
                {
                    Log.writeLogLine("LoadCharakterXML: Das Talent exestiert im aktuellen Kontext nicht " + Name);
                    return;
                }
                charakter.addTalent(talent);
            }
            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);
            }
            if (speakingMother != null)
            {
                LanguageAbstractTalent lt = (LanguageAbstractTalent)talent;
                lt.setMotherMark(speakingMother);
            }
        }