mirror of
https://github.com/xivapi/ffxiv-datamining.git
synced 2026-07-24 02:49:10 +00:00
Libra info
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Libra Database
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Josh Freeman <josh@viion.co.uk>
|
||||
*/
|
||||
|
||||
use LiteDatabase,
|
||||
LibraDatabaseTraits;
|
||||
|
||||
class LibraDatabase
|
||||
{
|
||||
use LibraDatabaseTraits;
|
||||
|
||||
protected $database;
|
||||
|
||||
function __construct($litefile)
|
||||
{
|
||||
if (!$litefile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->database = new LiteDatabase($litefile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this
|
||||
*
|
||||
* @return $this;
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tables from the libra database
|
||||
*
|
||||
* @return Array - tables
|
||||
*/
|
||||
public function tables()
|
||||
{
|
||||
$tables = $this->database->sql("SELECT name FROM sqlite_master WHERE type = 'table'");
|
||||
$tables = $this->sortDataByColumn($tables, 'name');
|
||||
return $tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run SQL on the libra database
|
||||
*
|
||||
* @param $string - the sql string to run
|
||||
* @return Array - array of data
|
||||
*/
|
||||
public function sql($sql)
|
||||
{
|
||||
return $this->database->sql($sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Libra Database Traits
|
||||
* bunch of functions for libra
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Josh Freeman <josh@viion.co.uk>
|
||||
*/
|
||||
|
||||
trait LibraDatabaseTraits
|
||||
{
|
||||
/**
|
||||
* Sorts an array by a column within the array,
|
||||
* main use is databases results
|
||||
*
|
||||
* @param $data - the data to resort
|
||||
* @param $column - the column to use for sorting
|
||||
* @return Array - the new array!
|
||||
*/
|
||||
protected function sortDataByColumn($data, $column)
|
||||
{
|
||||
$newData = [];
|
||||
foreach($data as $k => $v)
|
||||
{
|
||||
$newKey = $v[$column];
|
||||
$newData[$newKey] = $this->removeNumericIndexes($v);
|
||||
}
|
||||
|
||||
ksort($newData);
|
||||
return $newData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes numeric indexes, for some reason sqlite
|
||||
* returns both table column names and an index list,
|
||||
* so this helps strip index's and reduce data duplication
|
||||
*
|
||||
* @param $data - the array to remove from
|
||||
* @return Array - the new array, without numeric indexes!
|
||||
*/
|
||||
protected function removeNumericIndexes($data)
|
||||
{
|
||||
foreach($data as $k => $v)
|
||||
if (is_numeric($k))
|
||||
unset($data[$k]);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Libra Database
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Josh Freeman <josh@viion.co.uk>
|
||||
*/
|
||||
|
||||
use \PDO;
|
||||
|
||||
class LiteDatabase
|
||||
{
|
||||
protected $connection;
|
||||
|
||||
function __construct($sqlite)
|
||||
{
|
||||
if (!file_exists($sqlite)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// create connection
|
||||
$this->connection = new PDO('sqlite:'. $sqlite);
|
||||
if (!$this->connection) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private function track($type)
|
||||
{
|
||||
global $tracking;
|
||||
$tracking->update($type);
|
||||
}
|
||||
|
||||
public function sql($sql)
|
||||
{
|
||||
if (!$this->connection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->connection->prepare($sql);
|
||||
$query->execute();
|
||||
return $query->fetchAll();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# FFXIV Libra
|
||||
Libra is SE's official mobile application, it can be found here: http://eu.finalfantasyxiv.com/pr/special/libraeorzea/
|
||||
|
||||
# Downloading the App
|
||||
The easiest way to download the app is through the android store. https://play.google.com/store/apps/details?id=com.square_enix.libra_eorzeaE
|
||||
|
||||
You can Google this easily "Download APK" etc. Or you can get browser extensions to do it if you have an Android phone.
|
||||
|
||||
Note that even if you download the APK when SE "update it", it may not have the latest database version, the application itself when downloaded from the store only contains the last SQLite database from when the application was fully updated. If SE update the SQLite database but not the actual applications code, then it does not get updated on the store.
|
||||
|
||||
So in order to always have the most up to date SQLite file, you need a rooted android where you can view the installation of Libra and you can get the SQLite file from there.
|
||||
|
||||
# Viewing the data
|
||||
|
||||
You can use a tool such as SQLLiteBrowser to view the data, but it will not output the SQLite file correctly. I've included some PHP code which can be used to connect to the SQLite file and you can then do normal SQL queries on the file.
|
||||
Reference in New Issue
Block a user