|
|
@@ -173,7 +173,6 @@
|
|
|
INSERT INTO artifact (
|
|
|
uid,
|
|
|
id,
|
|
|
- assigned_to,
|
|
|
type,
|
|
|
attribute,
|
|
|
archetype,
|
|
|
@@ -183,29 +182,10 @@
|
|
|
value,
|
|
|
efficiency,
|
|
|
max_efficiency,
|
|
|
- main_stat,
|
|
|
- main_stat_value,
|
|
|
- effect_1,
|
|
|
- effect_1_value,
|
|
|
- effect_1_enchant,
|
|
|
- effect_1_grind,
|
|
|
- effect_2,
|
|
|
- effect_2_value,
|
|
|
- effect_2_enchant,
|
|
|
- effect_2_grind,
|
|
|
- effect_3,
|
|
|
- effect_3_value,
|
|
|
- effect_3_enchant,
|
|
|
- effect_3_grind,
|
|
|
- effect_4,
|
|
|
- effect_4_value,
|
|
|
- effect_4_enchant,
|
|
|
- effect_4_grind,
|
|
|
locked
|
|
|
) VALUES (
|
|
|
:uid,
|
|
|
:id,
|
|
|
- :assigned_to,
|
|
|
:type,
|
|
|
:attribute,
|
|
|
:archetype,
|
|
|
@@ -215,35 +195,11 @@
|
|
|
:value,
|
|
|
:efficiency,
|
|
|
:max_efficiency,
|
|
|
- :main_stat,
|
|
|
- :main_stat_value,
|
|
|
- :effect_1,
|
|
|
- :effect_1_value,
|
|
|
- :effect_1_enchant,
|
|
|
- :effect_1_grind,
|
|
|
- :effect_2,
|
|
|
- :effect_2_value,
|
|
|
- :effect_2_enchant,
|
|
|
- :effect_2_grind,
|
|
|
- :effect_3,
|
|
|
- :effect_3_value,
|
|
|
- :effect_3_enchant,
|
|
|
- :effect_3_grind,
|
|
|
- :effect_4,
|
|
|
- :effect_4_value,
|
|
|
- :effect_4_enchant,
|
|
|
- :effect_4_grind,
|
|
|
:locked
|
|
|
);
|
|
|
");
|
|
|
$statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
$statement->bindValue(":id", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
- if (intval($artifact->{"occupied_id"}) == 0){
|
|
|
- $statement->bindValue(":assigned_to", null, SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":assigned_to", $artifact->{"occupied_id"}, SQLITE3_INTEGER);
|
|
|
- }
|
|
|
if (intval($artifact->{"attribute"}) == 0){
|
|
|
$statement->bindValue(":attribute", null, SQLITE3_INTEGER);
|
|
|
}
|
|
|
@@ -271,57 +227,110 @@
|
|
|
$max_efficiency = 0; // Not standard formula yet
|
|
|
$statement->bindValue(":efficiency", $efficiency, SQLITE3_FLOAT);
|
|
|
$statement->bindValue(":max_efficiency", $max_efficiency, SQLITE3_FLOAT);
|
|
|
- $statement->bindValue(":main_stat", $artifact->{"pri_effect"}[0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":main_stat_value", $artifact->{"pri_effect"}[1], SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+
|
|
|
+ // Main stat
|
|
|
+ $statement = $db->prepare("
|
|
|
+ INSERT INTO artifact_stat (
|
|
|
+ artifact,
|
|
|
+ stat,
|
|
|
+ value
|
|
|
+ ) VALUES (
|
|
|
+ :artifact,
|
|
|
+ :stat,
|
|
|
+ :value
|
|
|
+ );
|
|
|
+ ");
|
|
|
+ $statement->bindValue(":artifact", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
+ $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 (
|
|
|
+ artifact,
|
|
|
+ slot,
|
|
|
+ effect,
|
|
|
+ value,
|
|
|
+ enchant,
|
|
|
+ grind,
|
|
|
+ rolls
|
|
|
+ ) VALUES (
|
|
|
+ :artifact,
|
|
|
+ :slot,
|
|
|
+ :effect,
|
|
|
+ :value,
|
|
|
+ :enchant,
|
|
|
+ :grind,
|
|
|
+ :rolls
|
|
|
+ );
|
|
|
+ ";
|
|
|
+
|
|
|
+ // Effect 1
|
|
|
if (sizeof($artifact->{"sec_effects"}) > 0){
|
|
|
- $statement->bindValue(":effect_1", $artifact->{"sec_effects"}[0][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_1_value", $artifact->{"sec_effects"}[0][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_1_enchant", $artifact->{"sec_effects"}[0][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_1_grind", $artifact->{"sec_effects"}[0][3], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":effect_1", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_1_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_1_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_1_grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($effect_query);
|
|
|
+ $statement->bindValue(":artifact", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", ARTIFACT_EFFECT_SLOT_ID::EFFECT_1, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":effect", $artifact->{"sec_effects"}[0][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $artifact->{"sec_effects"}[0][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $artifact->{"sec_effects"}[0][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $artifact->{"sec_effects"}[0][3], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
+
|
|
|
+ // Effect 2
|
|
|
if (sizeof($artifact->{"sec_effects"}) > 1){
|
|
|
- $statement->bindValue(":effect_2", $artifact->{"sec_effects"}[1][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_2_value", $artifact->{"sec_effects"}[1][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_2_enchant", $artifact->{"sec_effects"}[1][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_2_grind", $artifact->{"sec_effects"}[1][3], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":effect_2", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_2_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_2_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_2_grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($effect_query);
|
|
|
+ $statement->bindValue(":artifact", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", ARTIFACT_EFFECT_SLOT_ID::EFFECT_2, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":effect", $artifact->{"sec_effects"}[1][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $artifact->{"sec_effects"}[1][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $artifact->{"sec_effects"}[1][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $artifact->{"sec_effects"}[1][3], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
+
|
|
|
+ // Effect 3
|
|
|
if (sizeof($artifact->{"sec_effects"}) > 2){
|
|
|
- $statement->bindValue(":effect_3", $artifact->{"sec_effects"}[2][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_3_value", $artifact->{"sec_effects"}[2][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_3_enchant", $artifact->{"sec_effects"}[2][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_3_grind", $artifact->{"sec_effects"}[2][3], SQLITE3_INTEGER);
|
|
|
- }
|
|
|
- else{
|
|
|
- $statement->bindValue(":effect_3", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_3_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_3_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_3_grind", 0, SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($effect_query);
|
|
|
+ $statement->bindValue(":artifact", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", ARTIFACT_EFFECT_SLOT_ID::EFFECT_3, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":effect", $artifact->{"sec_effects"}[2][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $artifact->{"sec_effects"}[2][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $artifact->{"sec_effects"}[2][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $artifact->{"sec_effects"}[2][3], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
+
|
|
|
+ // Effect 4
|
|
|
if (sizeof($artifact->{"sec_effects"}) > 3){
|
|
|
- $statement->bindValue(":effect_4", $artifact->{"sec_effects"}[3][0], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_4_value", $artifact->{"sec_effects"}[3][1], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_4_enchant", $artifact->{"sec_effects"}[3][2], SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_4_grind", $artifact->{"sec_effects"}[3][3], SQLITE3_INTEGER);
|
|
|
+ $statement = $db->prepare($effect_query);
|
|
|
+ $statement->bindValue(":artifact", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":slot", ARTIFACT_EFFECT_SLOT_ID::EFFECT_4, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":effect", $artifact->{"sec_effects"}[3][0], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":value", $artifact->{"sec_effects"}[3][1], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":grind", $artifact->{"sec_effects"}[3][2], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":enchant", $artifact->{"sec_effects"}[3][3], SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rolls", 0, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
- else{
|
|
|
- $statement->bindValue(":effect_4", null, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_4_value", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_4_enchant", 0, SQLITE3_INTEGER);
|
|
|
- $statement->bindValue(":effect_4_grind", 0, SQLITE3_INTEGER);
|
|
|
+
|
|
|
+ // Assigned?
|
|
|
+ if (intval($artifact->{"occupied_id"}) != 0){
|
|
|
+ $statement = $db->prepare("
|
|
|
+ INSERT INTO unit_artifact (unit, artifact, rta)
|
|
|
+ VALUES (:unit, :artifact, :rta);
|
|
|
+ ");
|
|
|
+ $statement->bindValue(":unit", $artifact->{"occupied_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":artifact", $artifact->{"rid"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rta", GAME_MODE_ID::NORMAL, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
}
|
|
|
- $statement->execute();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -533,6 +542,15 @@
|
|
|
$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();
|
|
|
+ $statement = $db->prepare("DELETE FROM unit_artifact WHERE unit IN (SELECT id FROM unit WHERE uid = :uid);");
|
|
|
+ $statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+ $statement = $db->prepare("DELETE FROM artifact_stat WHERE artifact IN (SELECT id FROM artifact WHERE uid = :uid);");
|
|
|
+ $statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+ $statement = $db->prepare("DELETE FROM artifact_effect WHERE artifact IN (SELECT id FROM artifact WHERE uid = :uid);");
|
|
|
+ $statement->bindValue(":uid", $uid, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
$tables_to_clear = [
|
|
|
"scenario",
|
|
|
"defense",
|
|
|
@@ -978,6 +996,16 @@
|
|
|
parse_artifact($uid, $artifact);
|
|
|
}
|
|
|
}
|
|
|
+ foreach ($json->{"world_arena_artifact_equip_list"} as $rta_artifact){
|
|
|
+ $statement = $db->prepare("
|
|
|
+ INSERT INTO unit_artifact (unit, artifact, rta)
|
|
|
+ VALUES (:unit, :artifact, :rta);
|
|
|
+ ");
|
|
|
+ $statement->bindValue(":unit", $rta_artifact->{"occupied_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":artifact", $rta_artifact->{"artifact_id"}, SQLITE3_INTEGER);
|
|
|
+ $statement->bindValue(":rta", GAME_MODE_ID::RTA, SQLITE3_INTEGER);
|
|
|
+ $statement->execute();
|
|
|
+ }
|
|
|
|
|
|
// Parse enchantments
|
|
|
foreach ($json->{"rune_craft_item_list"} as $item){
|