Example #1
0
        /// <summary>
        /// Erzeugt einen neuen Trupp
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="data">GameData</param>
        /// <returns></returns>
        public static Troop create(int ID, GameData data)
        {
            MySqlDataReader Reader = data.Query("SELECT * FROM `PX_mom-troops` WHERE `ID` = '" + ID + "'");
            Reader.Read();

            int type = (int)Reader["Class"];
            string name = (string)Reader["Name"];
            User UID = data.getUser((int)Reader["UID"]);
            int power = (int)Reader["Power"];
            int health = (int)Reader["health"];
            int team = (int)Reader["team"];
            WorldPoint position = new WorldPoint((string)(Reader["worldpos"]));
            string states = (string)Reader["states"];
            int power2 = (int)Reader["Power2"];
            int power3 = (int)Reader["Power3"];
            int power4 = (int)Reader["Power4"];
            int resistend1 = (int)Reader["Resistend1"];
            int resistend2 = (int)Reader["Resistend2"];
            int resistend3 = (int)Reader["Resistend3"];
            int resistend4 = (int)Reader["Resistend4"];

            int hide = (int)Reader["hide"];
            string verhalten = (string)Reader["verhalten"];

            TroopClass typeClass = data.getTroopType(type);

            Troop troop = new Troop(ID, typeClass, UID, name, team, states);
            troop.position = position;
            troop.health = health;
            troop.power = power;
            troop.power2 = power2;
            troop.power3 = power3;
            troop.power4 = power4;
            troop.resistend1 = resistend1;
            troop.resistend2 = resistend2;
            troop.resistend3 = resistend3;
            troop.resistend4 = resistend4;
            troop.hide = hide;
            troop.verhalten = verhalten;

            troop.fighterTyp = FighterType.TROOP;

            Reader.Close();
            return troop;
        }