Exemplo n.º 1
0
        public int CreatNewPerso(int idRace, int idClasse, int idSousRace, int lvl, String nom, String prenom, String description)
        {
            int        idPerso = -1;
            GestionBDD conn    = new GestionBDD();
            // getStatRace
            DataTable tStatRace = conn.GetStatRaceByID(idRace);

            DataRow[] statsRace = tStatRace.Select();
            DicoInt   stats     = RandDicePerso(statsRace);

            DataTable tPerso = conn.GetPersos();

            DataRow[] rowPerso = tPerso.Select();
            String    idtmp    = rowPerso[rowPerso.Count() - 1]["id"].ToString();

            Int32.TryParse(idtmp, out idPerso);
            idPerso++;
            DataRow perso = tPerso.NewRow();

            perso["id"]         = idPerso;
            perso["race"]       = idRace;
            perso["sousrace"]   = idSousRace;
            perso["classe"]     = idClasse;
            perso["vivant"]     = true;
            perso["armedefaut"] = 0;
            perso["niveau"]     = lvl;
            perso["nom"]        = nom;
            perso["prenom"]     = prenom;
            perso["definition"] = description;
            tPerso.Rows.Add(perso);


            conn.SubmitDataSetChanges("perso");

            DataTable tStatPerso = conn.GetStatPersoByID(idPerso);

            DataRow[] rowStatPerso = tStatPerso.Select();
            foreach (DataRow row in rowStatPerso)
            {
                row.Delete();
            }
            foreach (int idStat in stats.Keys)
            {
                DataRow newStat = tStatPerso.NewRow();
                newStat["id_stat"]  = idStat;
                newStat["id_perso"] = idPerso;
                newStat["valeur"]   = stats[idStat];
                tStatPerso.Rows.Add(newStat);
            }

            conn.SubmitDataSetChanges("statperso");

            return(idPerso);
        }
Exemplo n.º 2
0
        public Genre(int id)
        {
            bdd = new GestionBDD();

            DataTable tGenre = bdd.GetGenreById(id);

            DataRow[] drGenre = tGenre.Select();
            this.poid           = Int32.Parse(drGenre[0]["poid"].ToString());
            this.prix           = Int32.Parse(drGenre[0]["prix"].ToString());
            this.typeEquipement = Int32.Parse(drGenre[0]["typequip"].ToString());
            this.typeObjet      = Int32.Parse(drGenre[0]["type"].ToString());
            this.nom            = drGenre[0]["nom"].ToString();
            this.definition     = drGenre[0]["definition"].ToString();
            this.damage         = Int32.Parse(drGenre[0]["dommage"].ToString());
            this.armureBase     = Int32.Parse(drGenre[0]["armurebase"].ToString());
            this.rmBase         = Int32.Parse(drGenre[0]["rmbase"].ToString());
            this.armureBonus    = Int32.Parse(drGenre[0]["armurebonus"].ToString());
            this.rmBonus        = Int32.Parse(drGenre[0]["rmbonus"].ToString());
            this.loot           = Boolean.Parse(drGenre[0]["loot"].ToString());
            this.degatcrit      = Int32.Parse(drGenre[0]["dcrit"].ToString());
            this.pSort          = Int32.Parse(drGenre[0]["psort"].ToString());
            this.nbMains        = Int32.Parse(drGenre[0]["nbmains"].ToString());
            this.pMin           = Int32.Parse(drGenre[0]["portermin"].ToString());
            this.pMax           = Int32.Parse(drGenre[0]["portermax"].ToString());
            this.chancecrit     = Int32.Parse(drGenre[0]["chanccrit"].ToString());
            DataTable tStatGenre = bdd.GetStatGenreByID(id);

            DataRow[] statsGenre = tStatGenre.Select();
            stat = new DicoInt();

            foreach (DataRow row in statsGenre)
            {
                int idstat = Int32.Parse(row["id_stat"].ToString());
                int valeur = Int32.Parse(row["valeur"].ToString());
                stat.Add(idstat, valeur);
            }


            DataTable tEffetGenre = bdd.GetEffetGenreByID(id);

            DataRow[] drEffetGenre = tEffetGenre.Select();
            effets = new List <Effet>();

            foreach (DataRow row in drEffetGenre)
            {
                effets.Add(new Effet(Int32.Parse(row["id_effet"].ToString())));
            }
        }
Exemplo n.º 3
0
        public DicoInt RandDicePerso(DataRow[] statsRace)
        {
            DicoInt stats = new DicoInt();

            foreach (DataRow row in statsRace)
            {
                int taille = -1;
                int nb     = -1;
                int id     = -1;
                Int32.TryParse(row["typedée"].ToString(), out taille);
                Int32.TryParse(row["NBDée"].ToString(), out nb);
                Int32.TryParse(row["id_stat"].ToString(), out id);
                int value = Roll.JetDée(taille, nb);
                stats.Add(id, value);
            }
            return(stats);
        }
Exemplo n.º 4
0
        public Materiel(int id)
        {
            bdd = new GestionBDD();

            DataTable tMateriel = bdd.GetMaterielById(id);

            DataRow[] drMateriel = tMateriel.Select();
            this.poid        = Int32.Parse(drMateriel[0]["poid"].ToString());
            this.prix        = Int32.Parse(drMateriel[0]["prix"].ToString());
            this.nom         = drMateriel[0]["nom"].ToString();
            this.definition  = drMateriel[0]["definition"].ToString();
            this.damage      = Int32.Parse(drMateriel[0]["dommage"].ToString());
            this.armureBase  = Int32.Parse(drMateriel[0]["armurebase"].ToString());
            this.rmBase      = Int32.Parse(drMateriel[0]["rmbase"].ToString());
            this.armureBonus = Int32.Parse(drMateriel[0]["armurebonus"].ToString());
            this.rmBonus     = Int32.Parse(drMateriel[0]["rmbonus"].ToString());
            this.degatcrit   = Int32.Parse(drMateriel[0]["dcrit"].ToString());
            this.pSort       = Int32.Parse(drMateriel[0]["psort"].ToString());
            this.chancecrit  = Int32.Parse(drMateriel[0]["chanccrit"].ToString());
            DataTable tStatMateriel = bdd.GetStatMaterielByID(id);

            DataRow[] statsMateriel = tStatMateriel.Select();
            stat = new DicoInt();

            foreach (DataRow row in statsMateriel)
            {
                int idstat = Int32.Parse(row["id_stat"].ToString());
                int valeur = Int32.Parse(row["valeur"].ToString());
                stat.Add(idstat, valeur);
            }


            DataTable tEffetMateriel = bdd.GetEffetMaterielByID(id);

            DataRow[] drEffetMateriel = tEffetMateriel.Select();
            effets = new List <Effet>();

            foreach (DataRow row in drEffetMateriel)
            {
                effets.Add(new Effet(Int32.Parse(row["id_effet"].ToString())));
            }
        }
Exemplo n.º 5
0
        public Race(int id)
        {
            bdd = new GestionBDD();
            DataTable tRace = bdd.GetRaceById(id);

            this.id = id;
            DataRow[] rowrace = tRace.Select();
            this.nom         = rowrace[0]["nom"].ToString();
            this.description = rowrace[0]["definition"].ToString();
            DataTable tStatRace = bdd.GetStatRaceByID(id);

            DataRow[] statsRace = tStatRace.Select();
            stat = new DicoInt();

            foreach (DataRow row in statsRace)
            {
                int idstat = Int32.Parse(row["id_stat"].ToString());
                int valeur = Int32.Parse(row["valeur"].ToString());
                stat.Add(idstat, valeur);
            }
        }
Exemplo n.º 6
0
 public Histoire()
 {
     stat = new DicoInt();
 }