1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| SQLiteConnection.CreateFile("BDD.sqlite");
SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=BDD.sqlite;Version=3;");
m_dbConnection.Open();
String SQL = "CREATE TABLE Levels (Level_Number INTEGER PRIMARY KEY AUTOINCREMENT, Level_HP INTEGER, Level_MP INTEGER, Level_Strength INTEGER, Level_Magic INTEGER, Level_Agility INTEGER, Level_Defense INTEGER, Level_Experience BIGINT)";
SQLiteCommand command = new SQLiteCommand(SQL, m_dbConnection);
command.ExecuteNonQuery();
int Level = 1;
int HP = 100;
int MP = 10;
int Strength = 10;
int Magic = 10;
int Agility = 10;
int Defense = 10;
SQL = "INSERT INTO Levels (Level_HP, Level_MP, Level_Strength, Level_Magic, Level_Agility, Level_Defense) VALUES (" + HP + ", " + MP + ", " + Strength + ", " + Magic + ", " + Agility + ", " + Defense + ")";
command = new SQLiteCommand(SQL, m_dbConnection);
command.ExecuteNonQuery();
while (Level < 1000)
{
HP = HP + 20;
MP = MP + 2;
Strength = Strength + 2;
Magic = Magic + 2;
Agility = Agility + 2;
Defense = Defense + 2;
SQL = "INSERT INTO Levels (Level_HP, Level_MP, Level_Strength, Level_Magic, Level_Agility, Level_Defense) VALUES (" + HP + ", " + MP + ", " + Strength + ", " + Magic + ", " + Agility + ", " + Defense + ")";
command = new SQLiteCommand(SQL, m_dbConnection);
command.ExecuteNonQuery();
Level++;
} |
Partager