|
|
@@ -3,7 +3,6 @@
|
|
|
require_once($path["page"] . "Page.php");
|
|
|
require_once($path["entity"] . "Monster.php");
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Urgent Skillup report page.
|
|
|
*/
|
|
|
@@ -14,13 +13,19 @@
|
|
|
*/
|
|
|
public $monsters = [];
|
|
|
|
|
|
+ /**
|
|
|
+ * The filters the page can handle.
|
|
|
+ */
|
|
|
public $filters = [
|
|
|
"min_stars" => 5,
|
|
|
"max_stars" => 6,
|
|
|
"min_natural_stars" => 5,
|
|
|
"max_natural_stars" => 5,
|
|
|
"in_storage" => true,
|
|
|
- "without_runes" => true
|
|
|
+ "without_runes" => true,
|
|
|
+ "family" => false,
|
|
|
+ "maxed" => false,
|
|
|
+ "2a" => false
|
|
|
];
|
|
|
|
|
|
/**
|
|
|
@@ -47,6 +52,10 @@
|
|
|
$this->canonical = $root . "report/skillups";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Parses the request looking for the selected filters, validates them
|
|
|
+ * and adds them to the $filters array.
|
|
|
+ */
|
|
|
private function parse_filters(){
|
|
|
if (isset($_GET["min_stars"]) && intval($_GET["min_stars"]) > 0 && intval($_GET["min_stars"]) < 7){
|
|
|
$this->filters["min_stars"] = $_GET["min_stars"];
|
|
|
@@ -66,9 +75,24 @@
|
|
|
if (isset($_GET["without_runes"]) && $_GET["without_runes"] != "on"){
|
|
|
$this->filters["without_runes"] = false;
|
|
|
}
|
|
|
+ if (isset($_GET["family"]) && $_GET["family"] == "on"){
|
|
|
+ $this->filters["family"] = true;
|
|
|
+ }
|
|
|
+ if (isset($_GET["maxed"]) && $_GET["maxed"] == "on"){
|
|
|
+ $this->filters["maxed"] = true;
|
|
|
+ }
|
|
|
+ if (isset($_GET["2a"]) && $_GET["2a"] == "on"){
|
|
|
+ $this->filters["2a"] = true;
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Builds the query to the rune table using the selected or default
|
|
|
+ * filters.
|
|
|
+ *
|
|
|
+ * @return The query to be executed.
|
|
|
+ */
|
|
|
private function build_query(){
|
|
|
$s =
|
|
|
"SELECT DISTINCT " .
|
|
|
@@ -119,15 +143,32 @@
|
|
|
" monster.stars <= " . $this->filters["max_stars"] . " AND " .
|
|
|
" k_monster.natural_stars >= " . $this->filters["min_natural_stars"] . " AND " .
|
|
|
" k_monster.natural_stars <= " . $this->filters["max_natural_stars"] . " ";
|
|
|
-
|
|
|
if (!$this->filters["in_storage"]){
|
|
|
$s = $s . " AND monster.in_storage = 0 ";
|
|
|
}
|
|
|
if (!$this->filters["without_runes"]){
|
|
|
$s = $s . " AND monster.id IN (SELECT DISTINCT monster FROM monster_rune) ";
|
|
|
}
|
|
|
+ if ($this->filters["family"]){
|
|
|
+ $s = $s . " AND monster.monster NOT IN (SELECT id FROM k_monster m WHERE family_id IN (SELECT family_id FROM k_monster k WHERE k.family_id = m.family_id AND k.natural_stars < m.natural_stars AND k.natural_stars < " . $this->filters["min_natural_stars"] . ")) ";
|
|
|
+ // Special case: Eirgar (Dark Vampire lord). Nat5 can be powered with 4 star Vampires.
|
|
|
+ if ($this->filters["min_natural_stars"] >= 5){
|
|
|
+ $s = $s . " AND k_monster.id <> 1279 AND k_monster.id <> 1280 ";
|
|
|
+ }
|
|
|
+ // Special case: Fran (Light Fairy Queen). Nat3 can be powered with 2 star Fairies.
|
|
|
+ if ($this->filters["min_natural_stars"] >= 3){
|
|
|
+ $s = $s . " AND k_monster.id <> 417 AND k_monster.id <> 418 ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!$this->filters["2a"]){
|
|
|
+ $s = $s . " AND (k_monster.awakens_from IS NULL OR k_monster.awakens_to IS NOT NULL OR k_monster.base_stars - k_monster.natural_stars = 1) ";
|
|
|
+ }
|
|
|
+ $s = $s .
|
|
|
+ "GROUP BY monster.id ";
|
|
|
+ if (!$this->filters["maxed"]){
|
|
|
+ $s = $s . " HAVING ponderated_level < ponderated_max_level ";
|
|
|
+ }
|
|
|
$s = $s .
|
|
|
- "GROUP BY monster.id " .
|
|
|
"ORDER BY " .
|
|
|
" ponderated_level * 100 / ponderated_max_level, " .
|
|
|
" monster.stars DESC, " .
|