Example #1
0
    void LoadQuestObjectives(QuestsData questData)
    {
        // Read all entries from the table
        string query = "SELECT * FROM " + "quest_objectives" + " where questID = " + questData.id;

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

        // Load data
        rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query);
        //Debug.Log("#Rows:"+rows.Count);
        // Read all the data
        if ((rows!=null) && (rows.Count > 0)) {
            foreach (Dictionary<string,string> data in rows) {
                QuestsObjectivesData entry = new QuestsObjectivesData ();

                entry.id = int.Parse (data ["id"]);
                entry.objectiveType = data ["objectiveType"];
                entry.target = int.Parse (data ["target"]);
                entry.targetCount = int.Parse (data ["targetCount"]);
                entry.targetText = data ["targetText"];
                questData.questObjectives.Add(entry);
            }
        }
    }
Example #2
0
    void UpdateObjective(QuestsObjectivesData entry)
    {
        string query = "UPDATE quest_objectives";
        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));
        }

        DatabasePack.Update (DatabasePack.contentDatabasePrefix, query, update);
    }
Example #3
0
    void InsertObjective(QuestsObjectivesData entry)
    {
        string query = "INSERT INTO quest_objectives";
        query += " (questID, primaryObjective, objectiveType, target, targetCount, targetText) ";
        query += "VALUES ";
        query += " (" + entry.questID + ",1,'" + entry.objectiveType + "'," + entry.target + "," + entry.targetCount + ",'" + entry.targetText + "') ";

        // 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;
    }