|
|
@@ -336,7 +336,6 @@
|
|
|
INSERT INTO rune (
|
|
|
uid,
|
|
|
id,
|
|
|
- assigned_to,
|
|
|
type,
|
|
|
slot,
|
|
|
stars,
|
|
|
@@ -347,31 +346,10 @@
|
|
|
value,
|
|
|
efficiency,
|
|
|
max_efficiency,
|
|
|
- main_stat,
|
|
|
- main_stat_value,
|
|
|
- innate_stat,
|
|
|
- innate_stat_value,
|
|
|
- substat_1,
|
|
|
- substat_1_value,
|
|
|
- substat_1_enchant,
|
|
|
- substat_1_grind,
|
|
|
- substat_2,
|
|
|
- substat_2_value,
|
|
|
- substat_2_enchant,
|
|
|
- substat_2_grind,
|
|
|
- substat_3,
|
|
|
- substat_3_value,
|
|
|
- substat_3_enchant,
|
|
|
- substat_3_grind,
|
|
|
- substat_4,
|
|
|
- substat_4_value,
|
|
|
- substat_4_enchant,
|
|
|
- substat_4_grind,
|
|
|
locked
|
|
|
) VALUES (
|
|
|
:uid,
|
|
|
:id,
|
|
|
- :assigned_to,
|
|
|
:type,
|
|
|
:slot,
|
|
|
:stars,
|
|
|
@@ -382,37 +360,11 @@
|
|
|
:value,
|
|
|
:efficiency,
|
|
|
:max_efficiency,
|
|
|
- :main_stat,
|
|
|
- :main_stat_value,
|
|
|
- :innate_stat,
|
|
|
- :innate_stat_value,
|
|
|
- :substat_1,
|
|
|
- :substat_1_value,
|
|
|
- :substat_1_enchant,
|
|
|
- :substat_1_grind,
|
|
|
- :substat_2,
|
|
|
- :substat_2_value,
|
|
|
- :substat_2_enchant,
|
|
|
- :substat_2_grind,
|
|
|
- :substat_3,
|
|
|
- :substat_3_value,
|
|
|
- :substat_3_enchant,
|
|
|
- :substat_3_grind,
|
|
|
- :substat_4,
|
|
|
- :substat_4_value,
|
|
|
- :substat_4_enchant,
|
|
|
- :substat_4_grind,
|
|
|
:locked
|
|
|
);
|
|
|
");
|
|
|
$statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":id", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
- if (intval($rune->{"occupied_id"}) == 0){
|
|
|
- $statement->bindValue(":assigned_to", null, SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":assigned_to", $rune->{"occupied_id"}, SQLITE3_INTEGER);
|
|
|
- }
|
|
|
$statement->bindValue(":type", $rune->{"set_id"}, SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":slot", $rune->{"slot_no"}, SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":value", $rune->{"sell_value"}, SQLITE3_INTEGER);
|
|
|
@@ -456,65 +408,97 @@
|
|
|
$max_efficiency = calculate_maximum_efficiency($rune);
|
|
|
$statement->bindValue(":efficiency", $efficiency, SQLITE3_FLOAT);
|
|
|
$statement->bindValue(":max_efficiency", $max_efficiency, SQLITE3_FLOAT);
|
|
|
- $statement->bindValue(":main_stat", $rune->{"pri_eff"}[0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":main_stat_value", $rune->{"pri_eff"}[1], SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+
|
|
|
+ $stat_statement = "
|
|
|
+ INSERT INTO rune_stat (rune, slot, stat, value, enchant, grind, rolls)
|
|
|
+ VALUES (:rune, :slot, :stat, :value, :enchant, :grind, :rolls);
|
|
|
+ ";
|
|
|
+
|
|
|
+ // Main stat
|
|
|
+ $statement = $db->prepare($stat_statement);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", RUNE_STAT_SLOT_ID::MAIN, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":stat", $rune->{"pri_eff"}[0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $rune->{"pri_eff"}[1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+
|
|
|
+ // Innate stat
|
|
|
if ($rune->{"prefix_eff"}[0] > 0){
|
|
|
- $statement->bindValue(":innate_stat", $rune->{"prefix_eff"}[0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":innate_stat_value", $rune->{"prefix_eff"}[1], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":innate_stat", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":innate_stat_value", 0, SQLITE3_INTEGER);
|
|
|
+ // Main stat
|
|
|
+ $statement = $db->prepare($stat_statement);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", RUNE_STAT_SLOT_ID::INNATE, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":stat", $rune->{"prefix_eff"}[0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $rune->{"prefix_eff"}[1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
if (sizeof($rune->{"sec_eff"}) > 0){
|
|
|
- $statement->bindValue(":substat_1", $rune->{"sec_eff"}[0][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_1_value", $rune->{"sec_eff"}[0][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_1_enchant", $rune->{"sec_eff"}[0][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_1_grind", $rune->{"sec_eff"}[0][3], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":substat_1", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_1_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_1_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_1_grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($stat_statement);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", RUNE_STAT_SLOT_ID::SUBSTAT_1, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":stat", $rune->{"sec_eff"}[0][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $rune->{"sec_eff"}[0][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $rune->{"sec_eff"}[0][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $rune->{"sec_eff"}[0][3], SQLITE3_INTEGER);
|
|
|
+ // TODO: Calculate rolls
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
if (sizeof($rune->{"sec_eff"}) > 1){
|
|
|
- $statement->bindValue(":substat_2", $rune->{"sec_eff"}[1][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_2_value", $rune->{"sec_eff"}[1][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_2_enchant", $rune->{"sec_eff"}[1][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_2_grind", $rune->{"sec_eff"}[1][3], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":substat_2", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_2_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_2_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_2_grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($stat_statement);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", RUNE_STAT_SLOT_ID::SUBSTAT_2, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":stat", $rune->{"sec_eff"}[1][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $rune->{"sec_eff"}[1][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $rune->{"sec_eff"}[1][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $rune->{"sec_eff"}[1][3], SQLITE3_INTEGER);
|
|
|
+ // TODO: Calculate rolls
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
if (sizeof($rune->{"sec_eff"}) > 2){
|
|
|
- $statement->bindValue(":substat_3", $rune->{"sec_eff"}[2][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_3_value", $rune->{"sec_eff"}[2][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_3_enchant", $rune->{"sec_eff"}[2][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_3_grind", $rune->{"sec_eff"}[2][3], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":substat_3", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_3_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_3_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_3_grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($stat_statement);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", RUNE_STAT_SLOT_ID::SUBSTAT_3, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":stat", $rune->{"sec_eff"}[2][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $rune->{"sec_eff"}[2][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $rune->{"sec_eff"}[2][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $rune->{"sec_eff"}[2][3], SQLITE3_INTEGER);
|
|
|
+ // TODO: Calculate rolls
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
if (sizeof($rune->{"sec_eff"}) > 3){
|
|
|
- $statement->bindValue(":substat_4", $rune->{"sec_eff"}[3][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_4_value", $rune->{"sec_eff"}[3][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_4_enchant", $rune->{"sec_eff"}[3][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_4_grind", $rune->{"sec_eff"}[3][3], SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($stat_statement);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", RUNE_STAT_SLOT_ID::SUBSTAT_4, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":stat", $rune->{"sec_eff"}[3][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $rune->{"sec_eff"}[3][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $rune->{"sec_eff"}[3][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $rune->{"sec_eff"}[3][3], SQLITE3_INTEGER);
|
|
|
+ // TODO: Calculate rolls
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
- else{
|
|
|
- $statement->bindValue(":substat_4", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_4_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_4_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":substat_4_grind", 0, SQLITE3_INTEGER);
|
|
|
+
|
|
|
+ // Assigned?
|
|
|
+ if (intval($rune->{"occupied_id"}) != 0){
|
|
|
+ $statement = $db->prepare("
|
|
|
+ INSERT INTO unit_rune (unit, rune, rta)
|
|
|
+ VALUES (:unit, :rune, :rta);
|
|
|
+ ");
|
|
|
+ $statement->bindValue(":unit", $rune->{"occupied_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rune", $rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rta", GAME_MODE_ID::NORMAL, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
- $statement->execute();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -543,6 +527,12 @@
|
|
|
$statement = $db->prepare("DELETE FROM unit_skill WHERE unit IN (SELECT id FROM unit WHERE uid = :uid);");
|
|
|
$statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
$statement->execute();
|
|
|
+ $statement = $db->prepare("DELETE FROM unit_rune WHERE unit IN (SELECT id FROM unit WHERE uid = :uid);");
|
|
|
+ $statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+ $statement = $db->prepare("DELETE FROM rune_stat WHERE rune IN (SELECT id FROM rune WHERE uid = :uid);");
|
|
|
+ $statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
$tables_to_clear = [
|
|
|
"scenario",
|
|
|
"defense",
|
|
|
@@ -876,7 +866,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Parse invetory
|
|
|
+ // Parse inventory
|
|
|
foreach ($json->{"inventory_info"} as $item){
|
|
|
$statement = $db->prepare("
|
|
|
INSERT INTO inventory (
|
|
|
@@ -968,6 +958,16 @@
|
|
|
parse_rune($uid, $rune, $rune_lock_list);
|
|
|
}
|
|
|
}
|
|
|
+ foreach ($json->{"world_arena_rune_equip_list"} as $rta_rune){
|
|
|
+ $statement = $db->prepare("
|
|
|
+ INSERT INTO unit_rune (unit, rune, rta)
|
|
|
+ VALUES (:unit, :rune, :rta);
|
|
|
+ ");
|
|
|
+ $statement->bindValue(":unit", $rta_rune->{"occupied_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rune", $rta_rune->{"rune_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rta", GAME_MODE_ID::RTA, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+ }
|
|
|
|
|
|
// Parse artifacts
|
|
|
foreach ($json->{"artifacts"} as $artifact){
|