|
|
@@ -76,14 +76,29 @@
|
|
|
$statement->bindValue(":level", $artifact->{"level"}, SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":quality", $artifact->{"rank"}, SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":original_quality", $artifact->{"natural_rank"}, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":value", 0, SQLITE3_INTEGER); // Not in JSON file
|
|
|
+ // I don'k know the value formula, but value only depends on quality, so... hardcoding.
|
|
|
+ switch ($artifact->{"natural_rank"}){
|
|
|
+ case QUALITY_ID::LEGEND:
|
|
|
+ $statement->bindValue(":value", 37660, SQLITE3_INTEGER);
|
|
|
+ break;
|
|
|
+ case QUALITY_ID::HERO:
|
|
|
+ $statement->bindValue(":value", 25250, SQLITE3_INTEGER);
|
|
|
+ break;
|
|
|
+ case QUALITY_ID::RARE:
|
|
|
+ $statement->bindValue(":value", 18461, SQLITE3_INTEGER);
|
|
|
+ break;
|
|
|
+ case QUALITY_ID::MAGIC:
|
|
|
+ $statement->bindValue(":value", 9330, SQLITE3_INTEGER);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $statement->bindValue(":value", 3870, SQLITE3_INTEGER);
|
|
|
+ }
|
|
|
$statement->bindValue(":locked", $artifact->{"locked"}, SQLITE3_INTEGER);
|
|
|
- $efficiency = 0; // Not standard formula yet
|
|
|
- $max_efficiency = 0; // Not standard formula yet
|
|
|
- $statement->bindValue(":efficiency", $efficiency, SQLITE3_FLOAT);
|
|
|
- $statement->bindValue(":max_efficiency", $max_efficiency, SQLITE3_FLOAT);
|
|
|
+ // Efficienccis will be caculated later, when instantiating the artifact.
|
|
|
+ $statement->bindValue(":efficiency", 0, SQLITE3_FLOAT);
|
|
|
+ $statement->bindValue(":max_efficiency", 0, SQLITE3_FLOAT);
|
|
|
$statement->execute();
|
|
|
-
|
|
|
+
|
|
|
// Main stat
|
|
|
$statement = $db->prepare("
|
|
|
INSERT INTO artifact_stat (
|
|
|
@@ -100,7 +115,7 @@
|
|
|
$statement->bindValue(":stat", $artifact->{"pri_effect"}[0], SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":value", $artifact->{"pri_effect"}[1], SQLITE3_INTEGER);
|
|
|
$statement->execute();
|
|
|
-
|
|
|
+
|
|
|
// Base effect insert query
|
|
|
$effect_query = "
|
|
|
INSERT INTO artifact_effect (
|
|
|
@@ -121,7 +136,7 @@
|
|
|
:rolls
|
|
|
);
|
|
|
";
|
|
|
-
|
|
|
+
|
|
|
// Effect 1
|
|
|
if (sizeof($artifact->{"sec_effects"}) > 0){
|
|
|
$statement = $db->prepare($effect_query);
|
|
|
@@ -134,7 +149,7 @@
|
|
|
$statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
$statement->execute();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Effect 2
|
|
|
if (sizeof($artifact->{"sec_effects"}) > 1){
|
|
|
$statement = $db->prepare($effect_query);
|
|
|
@@ -174,6 +189,9 @@
|
|
|
$statement->execute();
|
|
|
}
|
|
|
|
|
|
+ // Instantiate and calculate efficiency:
|
|
|
+ $instance = new Artifact($artifact->{"rid"});
|
|
|
+
|
|
|
// Assigned?
|
|
|
if (intval($artifact->{"occupied_id"}) != 0){
|
|
|
$statement = $db->prepare("
|
|
|
@@ -354,7 +372,6 @@
|
|
|
|
|
|
// Instantiate and calculate efficiency:
|
|
|
$instance = new Rune($rune->{"rune_id"});
|
|
|
-
|
|
|
|
|
|
// Assigned?
|
|
|
if (intval($rune->{"occupied_id"}) != 0){
|