コード例 #1
0
ファイル: ServerInstances.cs プロジェクト: zukeru/ageofasura
    void LoadInstancePortals(Instance instanceEntry)
    {
        // Read all entries from the table
        string query = "SELECT * FROM " + "island_portals" + " where island = " + instanceEntry.id;

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

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

                entry.id = int.Parse (data ["id"]);
                entry.name = data ["name"];
                entry.loc = new Vector3 (int.Parse (data ["locX"]), int.Parse (data ["locY"]), int.Parse (data ["locZ"]));
                entry.orient = new Quaternion(int.Parse (data ["orientX"]), int.Parse (data ["orientY"]), int.Parse (data ["orientZ"]), int.Parse (data ["orientW"]));
                instanceEntry.instancePortals.Add (entry);
            }
        }
    }
コード例 #2
0
ファイル: ServerInstances.cs プロジェクト: zukeru/ageofasura
    void UpdateItem(InstancePortalEntry entry)
    {
        string query = "UPDATE " + portalTableName;
        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.adminDatabasePrefix, query, update);
    }
コード例 #3
0
ファイル: ServerInstances.cs プロジェクト: zukeru/ageofasura
    void InsertItem(InstancePortalEntry entry)
    {
        string query = "INSERT INTO " + portalTableName;
        query += " (island, portalType, faction, displayID, locX, locY, locZ, orientX, orientY, orientZ, orientW, name) ";
        query += "VALUES ";
        query += " (" + entry.instanceID + "," + entry.portalType + "," + entry.faction + "," + entry.displayID + "," + entry.loc.x + ","
            + entry.loc.y + "," + entry.loc.z + "," + entry.orient.x + "," + entry.orient.y
            + "," + entry.orient.z + "," + entry.orient.w + ",'" + entry.name + "') ";

        // 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.adminDatabasePrefix, query, update);

        entry.id = itemID;
    }