|
@@ -54,7 +54,30 @@
|
|
|
"ehp": <?=$page->unit->effective_hp?>,
|
|
"ehp": <?=$page->unit->effective_hp?>,
|
|
|
"dmg": <?=$page->unit->effective_dmg?>
|
|
"dmg": <?=$page->unit->effective_dmg?>
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+<?php
|
|
|
|
|
+ // Get current rune sets
|
|
|
|
|
+ $sets = [];
|
|
|
|
|
+ foreach ($page->unit->rune as $rune){
|
|
|
|
|
+ if (!in_array($rune->type->id, $sets)){
|
|
|
|
|
+ array_push($sets, $rune->type->id);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for ($i = sizeof($sets); $i < 3; $i ++){
|
|
|
|
|
+ array_push($sets, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+?>
|
|
|
|
|
+ var current_sets = [<?=$sets[0]?>, <?=$sets[1]?>, <?=$sets[2]?>];
|
|
|
|
|
+
|
|
|
|
|
+ // Get current main stats in even slots
|
|
|
|
|
+<?php
|
|
|
|
|
+ $mains = [0, 0, 0];
|
|
|
|
|
+ foreach ($page->unit->rune as $rune){
|
|
|
|
|
+ if ($rune->slot % 2 == 0){
|
|
|
|
|
+ $mains[($rune->slot / 2) - 1] = $rune->main_stat;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+?>
|
|
|
/**
|
|
/**
|
|
|
* Updates the value next to the sliders when they change.
|
|
* Updates the value next to the sliders when they change.
|
|
|
*
|
|
*
|
|
@@ -126,6 +149,9 @@
|
|
|
// Optimizer tuning - mandatory
|
|
// Optimizer tuning - mandatory
|
|
|
params += '&tuning=' + document.getElementById('tuning').options[document.getElementById('tuning').selectedIndex].value;
|
|
params += '&tuning=' + document.getElementById('tuning').options[document.getElementById('tuning').selectedIndex].value;
|
|
|
|
|
|
|
|
|
|
+ // Limit combinations - mandatory
|
|
|
|
|
+ params += '&limit=' + document.getElementById('limit').value;
|
|
|
|
|
+
|
|
|
// Min HP - Optional
|
|
// Min HP - Optional
|
|
|
if (Number(document.getElementById('min_hp').value) > Number(document.getElementById('min_hp').min)){
|
|
if (Number(document.getElementById('min_hp').value) > Number(document.getElementById('min_hp').min)){
|
|
|
params += '&min_hp=' + document.getElementById('min_hp').value;
|
|
params += '&min_hp=' + document.getElementById('min_hp').value;
|
|
@@ -180,31 +206,51 @@
|
|
|
var xhttp = new XMLHttpRequest();
|
|
var xhttp = new XMLHttpRequest();
|
|
|
xhttp.onreadystatechange = function() {
|
|
xhttp.onreadystatechange = function() {
|
|
|
if (this.readyState == 4){
|
|
if (this.readyState == 4){
|
|
|
- if(this.status == 200) {
|
|
|
|
|
- showOptimizations(this.response, this.status);
|
|
|
|
|
|
|
+ document.getElementById('apply').removeAttribute('disabled');
|
|
|
|
|
+ document.getElementById('wait').style.display = 'none';
|
|
|
|
|
+ console.log("STATUS: " + this.status);
|
|
|
|
|
+ if (this.status == 200) {
|
|
|
|
|
+ showOptimizations(this.response);
|
|
|
}
|
|
}
|
|
|
else if (this.status == 413) { // Payload too large
|
|
else if (this.status == 413) { // Payload too large
|
|
|
- alert("Over 100 combination found. Plesase narow your criteria and retry.");
|
|
|
|
|
|
|
+ showMessage('Error', 'Too many combination found. Plesase narow your criteria and retry.');
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (this.status == 500) { // Server error
|
|
|
|
|
+ showMessage('Error', 'Too many rune combination found. Plesase narow your criteria and retry.');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// TODO DEBUG
|
|
// TODO DEBUG
|
|
|
- params = "uid=8114048&unit=6441802832&set[]=1&set[]=1&set[]=4&stat[]=4&stat[]=4&stat[]=4&source=0&tuning=0&min_defense=700";
|
|
|
|
|
|
|
+ //params = 'uid=8114048&unit=6441802832&limit=6&set[]=2&set[]=4&set[]=4&stat[]=4&stat[]=4&stat[]=4&source=0&tuning=2&min_defense=800';
|
|
|
|
|
|
|
|
- xhttp.open("POST", "/action/optimize/", true);
|
|
|
|
|
- xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
|
|
|
- xhttp.send(params);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function showOptimizations(content, status){
|
|
|
|
|
- var container = document.getElementById("optimizations");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Clear result table, disable button and show spinner
|
|
|
|
|
+ var container = document.getElementById('optimizations');
|
|
|
while (container.firstChild) {
|
|
while (container.firstChild) {
|
|
|
container.removeChild(container.firstChild);
|
|
container.removeChild(container.firstChild);
|
|
|
}
|
|
}
|
|
|
|
|
+ document.getElementById('apply').setAttribute('disabled', 'disabled');
|
|
|
|
|
+ document.getElementById('wait').style.display = 'block';
|
|
|
|
|
+ document.getElementById('results').style.display = 'none';
|
|
|
|
|
+
|
|
|
|
|
+ // Make the request
|
|
|
|
|
+ xhttp.open('POST', '/action/optimize/', true);
|
|
|
|
|
+ xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
|
|
|
|
+ xhttp.send(params);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Parses the received content and creates the HTML with the new
|
|
|
|
|
+ * rune options.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param content JSON received from server.
|
|
|
|
|
+ */
|
|
|
|
|
+ function showOptimizations(content){
|
|
|
|
|
+ var container = document.getElementById('optimizations');
|
|
|
var data = JSON.parse(content);
|
|
var data = JSON.parse(content);
|
|
|
if (Number(data.total) == 0){
|
|
if (Number(data.total) == 0){
|
|
|
- alert("No results");
|
|
|
|
|
|
|
+ showMessage('No results', 'No suitable combination found. Plesase relax your criteria and retry.');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
var option;
|
|
var option;
|
|
@@ -592,8 +638,30 @@
|
|
|
tr.appendChild(td);
|
|
tr.appendChild(td);
|
|
|
container.appendChild(tr);
|
|
container.appendChild(tr);
|
|
|
|
|
|
|
|
|
|
+ // Make the section visible
|
|
|
|
|
+ document.getElementById('results').style.display = 'block';
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Displays a pop-up message.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param title Message title.
|
|
|
|
|
+ * @param text Message content.
|
|
|
|
|
+ */
|
|
|
|
|
+ function showMessage(title, text){
|
|
|
|
|
+ document.getElementById('message_title').innerHTML = title;
|
|
|
|
|
+ document.getElementById('message_text').innerHTML = text;
|
|
|
|
|
+ document.getElementById('message_container').style.display = 'block';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Closes the message pop-up.
|
|
|
|
|
+ */
|
|
|
|
|
+ function closeMessage(){
|
|
|
|
|
+ document.getElementById('message_container').style.display = 'none';
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
</head>
|
|
</head>
|
|
|
<body>
|
|
<body>
|
|
@@ -897,23 +965,10 @@
|
|
|
</article> <!-- #profile -->
|
|
</article> <!-- #profile -->
|
|
|
<article id='current_runes'>
|
|
<article id='current_runes'>
|
|
|
<?php
|
|
<?php
|
|
|
- $total_efficiency = 0;
|
|
|
|
|
- $total_max_efficiency = 0;
|
|
|
|
|
- $total_reached_efficiency = 0;
|
|
|
|
|
- $total_level = 0;
|
|
|
|
|
- $total_stars = 0;
|
|
|
|
|
- $total_value = 0;
|
|
|
|
|
- $total_runes = 0;
|
|
|
|
|
$show_list = [6, 1, 2, 5, 4, 3];
|
|
$show_list = [6, 1, 2, 5, 4, 3];
|
|
|
//foreach ($page->unit->rune as $rune){
|
|
//foreach ($page->unit->rune as $rune){
|
|
|
foreach ($show_list as $i){
|
|
foreach ($show_list as $i){
|
|
|
$rune = $page->unit->rune[$i - 1];
|
|
$rune = $page->unit->rune[$i - 1];
|
|
|
- $total_efficiency += $rune->efficiency;
|
|
|
|
|
- $total_max_efficiency += $rune->max_efficiency;
|
|
|
|
|
- $total_reached_efficiency += ($rune->efficiency * 100 / $rune->max_efficiency);
|
|
|
|
|
- $total_level += $rune->level;
|
|
|
|
|
- $total_stars += $rune->stars;
|
|
|
|
|
- $total_value += $rune->value;
|
|
|
|
|
$total_runes ++;
|
|
$total_runes ++;
|
|
|
?>
|
|
?>
|
|
|
<?=HTML::rune_table($rune)?>
|
|
<?=HTML::rune_table($rune)?>
|
|
@@ -926,66 +981,6 @@
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|
|
|
</article>
|
|
</article>
|
|
|
- <article id='rune_averages'>
|
|
|
|
|
- <table id='table_averages'>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Avg. level:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=number_format($total_level / $total_runes, 2)?>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Avg. stars:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=number_format($total_stars / $total_runes, 2)?>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Avg. value:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=number_format($total_value / $total_runes, 2, '.', '')?>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Total value:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=$total_value?>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Avg. efficiency:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=number_format($total_efficiency / $total_runes, 2)?>%
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Avg. max. efficiency:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=number_format($total_max_efficiency / $total_runes, 2)?>%
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td class='title'>
|
|
|
|
|
- Avg. reached efficiency:
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class='value'>
|
|
|
|
|
- <?=number_format($total_reached_efficiency / $total_runes, 2)?>%
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </table>
|
|
|
|
|
- </article>
|
|
|
|
|
</section> <!-- runes -->
|
|
</section> <!-- runes -->
|
|
|
<section id='parameters' class='content'>
|
|
<section id='parameters' class='content'>
|
|
|
<h2>
|
|
<h2>
|
|
@@ -1005,7 +1000,7 @@
|
|
|
<?php
|
|
<?php
|
|
|
foreach($reflect->getConstants() as $name => $id){
|
|
foreach($reflect->getConstants() as $name => $id){
|
|
|
$selected = "";
|
|
$selected = "";
|
|
|
- if (in_array($id, $filters["MAIN"])){
|
|
|
|
|
|
|
+ if ($id == $sets[0]){
|
|
|
$selected = "selected='selected'";
|
|
$selected = "selected='selected'";
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|
|
@@ -1018,7 +1013,7 @@
|
|
|
<?php
|
|
<?php
|
|
|
foreach($reflect->getConstants() as $name => $id){
|
|
foreach($reflect->getConstants() as $name => $id){
|
|
|
$selected = "";
|
|
$selected = "";
|
|
|
- if (in_array($id, $filters["MAIN"])){
|
|
|
|
|
|
|
+ if ($id == $sets[1]){
|
|
|
$selected = "selected='selected'";
|
|
$selected = "selected='selected'";
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|
|
@@ -1032,7 +1027,7 @@
|
|
|
<?php
|
|
<?php
|
|
|
foreach($reflect->getConstants() as $name => $id){
|
|
foreach($reflect->getConstants() as $name => $id){
|
|
|
$selected = "";
|
|
$selected = "";
|
|
|
- if (in_array($id, $filters["MAIN"])){
|
|
|
|
|
|
|
+ if ($id == $sets[2]){
|
|
|
$selected = "selected='selected'";
|
|
$selected = "selected='selected'";
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|
|
@@ -1058,24 +1053,24 @@
|
|
|
</td>
|
|
</td>
|
|
|
<td class='value'>
|
|
<td class='value'>
|
|
|
<select id='slot_2'>
|
|
<select id='slot_2'>
|
|
|
- <option value='<?=RUNE_STAT_ID::HP_P?>'>HP%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::ATK_P?>'>ATK%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::DEF_P?>'>DEF%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::SPD?>'>SPD</option>
|
|
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::HP_P?>' <?=($mains[0] == RUNE_STAT_ID::HP_P) ? ("selected='selected'") : ("");?>>HP%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=($mains[0] == RUNE_STAT_ID::ATK_P) ? ("selected='selected'") : ("");?>>ATK%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=($mains[0] == RUNE_STAT_ID::DEF_P) ? ("selected='selected'") : ("");?>>DEF%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::SPD?>' <?=($mains[0] == RUNE_STAT_ID::SPD) ? ("selected='selected'") : ("");?>>SPD</option>
|
|
|
</select>
|
|
</select>
|
|
|
<select id='slot_4'>
|
|
<select id='slot_4'>
|
|
|
- <option value='<?=RUNE_STAT_ID::HP_P?>'>HP%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::ATK_P?>'>ATK%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::DEF_P?>'>DEF%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::CRR?>'>CRR</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::CRR?>'>CRD</option>
|
|
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::HP_P?>' <?=($mains[1] == RUNE_STAT_ID::HP_P) ? ("selected='selected'") : ("");?>>HP%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=($mains[1] == RUNE_STAT_ID::ATK_P) ? ("selected='selected'") : ("");?>>ATK%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=($mains[1] == RUNE_STAT_ID::DEF_P) ? ("selected='selected'") : ("");?>>DEF%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::CRR?>' <?=($mains[1] == RUNE_STAT_ID::CRR) ? ("selected='selected'") : ("");?>>CRR</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::CRR?>' <?=($mains[1] == RUNE_STAT_ID::CRD) ? ("selected='selected'") : ("");?>>CRD</option>
|
|
|
</select>
|
|
</select>
|
|
|
<select id='slot_6'>
|
|
<select id='slot_6'>
|
|
|
- <option value='<?=RUNE_STAT_ID::HP_P?>'>HP%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::ATK_P?>'>ATK%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::DEF_P?>'>DEF%</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::ACC?>'>ACC</option>
|
|
|
|
|
- <option value='<?=RUNE_STAT_ID::RES?>'>RES</option>
|
|
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::HP_P?>' <?=($mains[2] == RUNE_STAT_ID::HP_P) ? ("selected='selected'") : ("");?>>HP%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=($mains[2] == RUNE_STAT_ID::ATK_P) ? ("selected='selected'") : ("");?>>ATK%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=($mains[2] == RUNE_STAT_ID::DEF_P) ? ("selected='selected'") : ("");?>>DEF%</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::ACC?>' <?=($mains[2] == RUNE_STAT_ID::ACC) ? ("selected='selected'") : ("");?>>ACC</option>
|
|
|
|
|
+ <option value='<?=RUNE_STAT_ID::RES?>' <?=($mains[2] == RUNE_STAT_ID::RES) ? ("selected='selected'") : ("");?>>RES</option>
|
|
|
</select>
|
|
</select>
|
|
|
</td>
|
|
</td>
|
|
|
<td class='empty'>
|
|
<td class='empty'>
|
|
@@ -1135,8 +1130,10 @@
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
|
<td class='empty'>
|
|
<td class='empty'>
|
|
|
|
|
+ Max. combinations
|
|
|
</td>
|
|
</td>
|
|
|
<td class='empty'>
|
|
<td class='empty'>
|
|
|
|
|
+ <input id='limit' type='number' value='10' max='100' min='1'>
|
|
|
</td>
|
|
</td>
|
|
|
<td class='empty'>
|
|
<td class='empty'>
|
|
|
</td>
|
|
</td>
|
|
@@ -1210,9 +1207,10 @@
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
|
<td class='action'>
|
|
<td class='action'>
|
|
|
- <input type='button' value='Apply' onClick='apply();'/>
|
|
|
|
|
|
|
+ <input id='apply' type='button' value='Apply' onClick='apply();'/>
|
|
|
</td>
|
|
</td>
|
|
|
<td class='empty'>
|
|
<td class='empty'>
|
|
|
|
|
+ <img id='wait' src='<?=URL::IMG["ICON"] . "wait.gif";?>'>
|
|
|
</td>
|
|
</td>
|
|
|
<td class='empty'>
|
|
<td class='empty'>
|
|
|
</td>
|
|
</td>
|
|
@@ -1242,6 +1240,19 @@
|
|
|
</table>
|
|
</table>
|
|
|
</article>
|
|
</article>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
+ <div id='message_container'>
|
|
|
|
|
+ <section class='content'>
|
|
|
|
|
+ <h2 id='message_title'>
|
|
|
|
|
+ Message
|
|
|
|
|
+ </h2>
|
|
|
|
|
+ <article>
|
|
|
|
|
+ <p id='message_text'>
|
|
|
|
|
+ Message Text
|
|
|
|
|
+ </p>
|
|
|
|
|
+ </article>
|
|
|
|
|
+ <input type='button' value='OK' id='message_button' onclick='closeMessage();'/>
|
|
|
|
|
+ </section>
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
<?php
|
|
<?php
|
|
|
include __DIR__ . "/inc/footer.php";
|
|
include __DIR__ . "/inc/footer.php";
|