Esempio n. 1
0
    public void onPickupItem(NetworkMessage netMsg)
    {
        moveItem        item = netMsg.ReadMessage <moveItem>();
        MySqlConnection conn;
        int             playerID = getCharacterIDFromDir(item.player);

        Debug.Log("wew from pickup: " + item.player + " : " + playerID);
        mysqlNonQuerySelector(out conn, "INSERT INTO inventory (playerID, itemID, WAtt, MAtt, Luk, position) VALUES ('" + playerID + "','" + item.item1[0] + "','" + item.item1[1] + "','" + item.item1[2] + "','" + item.item1[3] + "','" + item.item1[4] + "')");
        conn.Close();
    }
Esempio n. 2
0
    public void moveItem(int[] itemMoved, int[] itemReplaced, short packetType, Player player)
    {
        moveItem item = new moveItem();

        item.item1    = itemMoved;
        item.item2    = itemReplaced;
        item.player   = player.playerName;
        item.position = new float[] { player.transform.position.x, player.transform.position.y, player.transform.position.z };
        con.Send(packetType, item);
    }
Esempio n. 3
0
    public void moveItem(Item itemMoved, Item itemReplaced, short packetType, Player player)
    {
        moveItem item = new moveItem();

        item.item1  = Tools.objectToByteArray(itemMoved);
        item.item2  = Tools.objectToByteArray(itemReplaced);
        item.player = player.playerName;
        //item.position = new float[] { player.transform.position.x, player.transform.position.y, player.transform.position.z};
        con.Send(packetType, item);
    }
Esempio n. 4
0
    public void onDropItem(NetworkMessage netMsg)
    {
        moveItem        item = netMsg.ReadMessage <moveItem>();
        MySqlConnection conn;
        MySqlDataReader reader;
        int             characterID = getCharacterIDFromDir(item.player);

        //Debug.Log("wew from drop: " + item.name + " : " + sqlItemStatement(item.item1));
        mysqlReader(out conn, out reader, "SELECT * FROM inventory WHERE characterID = " + characterID + " AND " + sqlItemStatement(item.item1) + "");
        mysqlNonQuerySelector(out conn, "DELETE FROM inventory WHERE characterID = " + characterID + " AND " + sqlItemStatement(item.item1) + "");
        conn.Close();
        GameObject itemObject = spawnObject("Drop", new Vector3(item.position[0], item.position[1], item.position[2]));
    }
Esempio n. 5
0
    public void onChangeItem(NetworkMessage netMsg)
    {
        moveItem        item = netMsg.ReadMessage <moveItem>();
        MySqlConnection conn;
        //ServerDebug("hello from server");
        int playerID = getCharacterIDFromDir(item.player);

        Debug.Log("item1: " + item.item1[8] + " item2: " + item.item2[8]);
        mysqlNonQuerySelector(out conn, "UPDATE inventory SET position = '" + item.item1[8] + "' WHERE characterID = '" + playerID + "' AND " + sqlItemStatement(item.item1) + "");
        if (item.item2[0] != -1)
        {
            mysqlNonQuerySelector(out conn, "UPDATE inventory SET position = '" + item.item2[8] + "'  WHERE characterID = '" + playerID + "' AND " + sqlItemStatement(item.item2) + "");
        }
        conn.Close();
    }
Esempio n. 6
0
    public void onChangeItem(NetworkMessage netMsg)
    {
        moveItem        item = netMsg.ReadMessage <moveItem>();
        MySqlConnection conn;
        //ServerDebug("hello from server");
        int playerID = getCharacterIDFromDir(item.player);

        Debug.Log("item1: " + item.item2[Tools.ITEM_PROPERTY_SIZE - 1] + " item2: " + item.item1[Tools.ITEM_PROPERTY_SIZE - 2] + " item2: " + item.item1[0]);
        mysqlNonQuerySelector(out conn, "UPDATE inventory SET position = '" + item.item1[Tools.ITEM_PROPERTY_SIZE - 1] + "' WHERE id = '" + item.item1[Tools.ITEM_PROPERTY_SIZE - 3] + "'");
        if (item.item2[0] != -1)
        {
            mysqlNonQuerySelector(out conn, "UPDATE inventory SET position = '" + item.item2[Tools.ITEM_PROPERTY_SIZE - 1] + "' WHERE id = '" + item.item2[Tools.ITEM_PROPERTY_SIZE - 3] + "'");
        }
        conn.Close();
    }