예제 #1
0
    void InsertSkill(CharSkillsData entry)
    {
        string query = "INSERT INTO character_create_skills";
        query += " (character_create_id, skill) ";
        query += "VALUES ";
        query += " (" + entry.charId + "," + entry.skill + ") ";

        // Setup the register data
        List<Register> update = new List<Register> ();
        foreach (string field in entry.fields.Keys) {
            update.Add (entry.fieldToRegister (field));
        }

        int itemID = -1;
        itemID = DatabasePack.Insert (DatabasePack.contentDatabasePrefix, query, update);
        entry.id = itemID;
    }
예제 #2
0
    // Update existing entries in the table based on the iddemo_table
    void UpdateSkill(CharSkillsData entry)
    {
        // Setup the update query
        string query = "UPDATE character_create_skills";
        query += " SET ";
        query += entry.UpdateList ();
        query += " WHERE id=?id";

        // Setup the register data
        List<Register> update = new List<Register> ();
        foreach (string field in entry.fields.Keys) {
            update.Add (entry.fieldToRegister (field));
        }
        update.Add (new Register ("id", "?id", MySqlDbType.Int32, entry.id.ToString (), Register.TypesOfField.Int));

        // Update the database
        DatabasePack.Update (DatabasePack.contentDatabasePrefix, query, update);
    }
예제 #3
0
    // Load Stats
    public void LoadCharacterSkills(CharData charData)
    {
        List<CharSkillsData> charSkills = new List<CharSkillsData>();
        // Read all entries from the table
        string query = "SELECT * FROM character_create_skills WHERE character_create_id = " + charData.id;

        // If there is a row, clear it.
        if (rows != null)
            rows.Clear ();

        // Load data
        rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query);
        // Read all the data
        if ((rows!=null) && (rows.Count > 0)) {
            foreach (Dictionary<string,string> data in rows) {
                CharSkillsData display = new CharSkillsData ();
                display.id = int.Parse (data ["id"]);
                display.charId = int.Parse (data ["character_create_id"]);
                display.skill = int.Parse (data ["skill"]);
                charSkills.Add(display);
            }
        }
        charData.charSkills = charSkills;
    }