mh4u: use db data, move to subdir
This commit is contained in:
@@ -664,7 +664,8 @@ class ItemStars(object):
|
|||||||
if stars is not None:
|
if stars is not None:
|
||||||
return stars
|
return stars
|
||||||
|
|
||||||
stars = dict(Village=None, Guild=None, Permit=None, Arena=None)
|
stars = dict(Village=None, Guild=None, Permit=None, Arena=None,
|
||||||
|
Event=None)
|
||||||
costs = get_costs(self.db, weapon)
|
costs = get_costs(self.db, weapon)
|
||||||
# find least 'expensive' path
|
# find least 'expensive' path
|
||||||
for c in costs:
|
for c in costs:
|
||||||
@@ -679,7 +680,7 @@ class ItemStars(object):
|
|||||||
|
|
||||||
def _get_component_stars(self, c):
|
def _get_component_stars(self, c):
|
||||||
# need to track unititialized vs unavailable
|
# need to track unititialized vs unavailable
|
||||||
stars = dict(Village=0, Guild=0, Permit=0, Arena=0)
|
stars = dict(Village=0, Guild=0, Permit=0, Arena=0, Event=0)
|
||||||
for item_name in c["components"].keys():
|
for item_name in c["components"].keys():
|
||||||
item = self.db.get_item_by_name(item_name)
|
item = self.db.get_item_by_name(item_name)
|
||||||
if item.type == "Materials":
|
if item.type == "Materials":
|
||||||
@@ -716,7 +717,8 @@ class ItemStars(object):
|
|||||||
if stars is not None:
|
if stars is not None:
|
||||||
return stars
|
return stars
|
||||||
|
|
||||||
stars = dict(Village=None, Guild=None, Permit=None, Arena=None)
|
stars = dict(Village=None, Guild=None, Permit=None, Arena=None,
|
||||||
|
Event=None)
|
||||||
rows = self.db.get_material_items(material_item_id)
|
rows = self.db.get_material_items(material_item_id)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
item = self.db.get_item(row["item_id"])
|
item = self.db.get_item(row["item_id"])
|
||||||
@@ -732,7 +734,8 @@ class ItemStars(object):
|
|||||||
if stars is not None:
|
if stars is not None:
|
||||||
return stars
|
return stars
|
||||||
|
|
||||||
stars = dict(Village=None, Guild=None, Permit=None, Arena=None)
|
stars = dict(Village=None, Guild=None, Permit=None, Arena=None,
|
||||||
|
Event=None)
|
||||||
|
|
||||||
quests = self.db.get_item_quests(item_id)
|
quests = self.db.get_item_quests(item_id)
|
||||||
|
|
||||||
@@ -754,6 +757,9 @@ class ItemStars(object):
|
|||||||
|
|
||||||
# find least expensive quest for getting the item
|
# find least expensive quest for getting the item
|
||||||
for quest in quests:
|
for quest in quests:
|
||||||
|
if quest.hub == "Caravan":
|
||||||
|
# For mh4u, map Caravan->Village
|
||||||
|
quest.hub = "Village"
|
||||||
if quest.stars == 0:
|
if quest.stars == 0:
|
||||||
# ignore training quests
|
# ignore training quests
|
||||||
if "Training" not in quest.name:
|
if "Training" not in quest.name:
|
||||||
|
|||||||
@@ -44,20 +44,20 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="recommends.html" method="GET">
|
<form action="mh4u/recommends.html" method="GET">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend title="Find the best quests and armor skills for farming an item."
|
<legend title="Find the best quests and armor skills for farming an item."
|
||||||
>Poogie Recommends</legend>
|
>Poogie Recommends (4U)</legend>
|
||||||
<label for="item">Item:</label>
|
<label for="item">Item:</label>
|
||||||
<input id="item" name="item" type="text" size="20" />
|
<input id="item" name="item" type="text" size="20" />
|
||||||
<input type="submit" value="Ask Poogie" />
|
<input type="submit" value="Ask Poogie" />
|
||||||
<p></p>
|
<p></p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<form action="weaponplanner.html" method="GET">
|
<form action="mh4u/weaponplanner.html" method="GET">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend title="Compare the cost of making a weapon from different starting points in the tree"
|
<legend title="Compare the cost of making a weapon from different starting points in the tree"
|
||||||
>Poogie's Weapon Planner</legend>
|
>Poogie's Weapon Planner (4U)</legend>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for="type">Type:</label></td>
|
<td><label for="type">Type:</label></td>
|
||||||
@@ -84,16 +84,40 @@
|
|||||||
<td><input id="weapon" name="weapon" weapon="text" size="20" />
|
<td><input id="weapon" name="weapon" weapon="text" size="20" />
|
||||||
<input type="submit" value="Ask Poogie" /></td>
|
<input type="submit" value="Ask Poogie" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr><td colspan="2">Weapon Search:
|
||||||
|
(<a href="mh4u/weaponlist.html">MH4U</a>,
|
||||||
|
<a href="mhx/weaponlist.html">MHX</a>,
|
||||||
|
<a href="mhgen/weaponlist.html">MHGen</a>,
|
||||||
|
<a href="mhgu/weaponlist.html">MHGU</a>)</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend title="Plan armor sets">Poogie Outfitters</legend>
|
<legend title="Plan armor sets">Poogie Outfitters (4U)</legend>
|
||||||
<a href="outfitters.html">Armor set planner</a>
|
<a href="mh4u/outfitters.html">Armor set planner</a>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<br />
|
<br />
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend title="Mobile friendly translation guide">Poogie トランスレーター</legend>
|
<legend title="Mobile friendly translation guide">Poogie トランスレーター (MHX)</legend>
|
||||||
<a href="translate/">English to Japanese translation guide</a>
|
<a href="translate/">English to Japanese translation guide</a> (mobile friendly)
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<h2>Acknowledgements</h2>
|
||||||
|
Data is primary from the excellent 4U and Gen android apps:
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/kamegami13/MonsterHunter4UDatabase">MonsterHunter4UDatabase</a></li>
|
||||||
|
<li><a href="https://github.com/gatheringhallstudios/MHGenDatabase">MHGenDatabase</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Also sourced for MHX translation and weapon data:
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://monsterhunter.wikia.com/wiki/MHX"
|
||||||
|
>Monster Hunter X Wiki (Wikia)</a></li>
|
||||||
|
<li><a href="http://wiki.mhxg.org/"
|
||||||
|
>http://wiki.mhxg.org/</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
If you find errors or have suggestions, email poogie at mhapi.info,
|
||||||
|
or contact <a href="https://www.reddit.com/u/bda82">/u/bda82</a> on reddit.
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Poogie Recommends</title>
|
<title>Poogie Recommends (4U)</title>
|
||||||
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
||||||
|
|
||||||
<script src="js/common.js"></script>
|
<script src="/js/common.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.flex {
|
.flex {
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
display_item(normalized_name);
|
display_item(normalized_name);
|
||||||
console.log("replaceState: " + normalized_name);
|
console.log("replaceState: " + normalized_name);
|
||||||
window.history.replaceState({ "item_name": normalized_name }, "",
|
window.history.replaceState({ "item_name": normalized_name }, "",
|
||||||
"/recommends.html?item="
|
"/mh4u/recommends.html?item="
|
||||||
+ encoded_name );
|
+ encoded_name );
|
||||||
}
|
}
|
||||||
$(window).on("popstate", function(e) {
|
$(window).on("popstate", function(e) {
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
display_item(normalized_name);
|
display_item(normalized_name);
|
||||||
console.log("pushState: " + normalized_name);
|
console.log("pushState: " + normalized_name);
|
||||||
window.history.pushState({ "item_name": normalized_name }, "",
|
window.history.pushState({ "item_name": normalized_name }, "",
|
||||||
"/recommends.html?item=" + encoded_name );
|
"/mh4u/recommends.html?item=" + encoded_name );
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_item(normalized_name) {
|
function display_item(normalized_name) {
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Poogie's Weapon List</title>
|
<title>Poogie's Weapon List (MH4U)</title>
|
||||||
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/ejs_production.js"></script>
|
<script type="text/javascript" src="../js/ejs_production.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/common.js"></script>
|
<script type="text/javascript" src="../js/common.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
label {
|
label {
|
||||||
@@ -97,14 +97,32 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DATA_PATH = get_base_path() + "/jsonapi/";
|
var WEAPON_LIST = null;
|
||||||
|
var HORN_MELODY_MAP = null;
|
||||||
|
|
||||||
var template_row = new EJS({ url: "templates/weaponrow.ejs" });
|
$.ajax({
|
||||||
|
url: "../jsonapi/mh4u/weapon/_all.json",
|
||||||
|
async: false,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
WEAPON_LIST = data;
|
||||||
|
console.log("weapon count " + WEAPON_LIST.length);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "../jsonapi/mh4u/horn_melody/_index_notes.json",
|
||||||
|
async: false,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
HORN_MELODY_MAP = data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var template_row = new EJS({ url: "../templates/weaponrow.ejs" });
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
load_weapon_data(function() {
|
init_page();
|
||||||
load_calculating_palico_data(init_page);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#sharpness_popup").on("click", function(evt) {
|
$("#sharpness_popup").on("click", function(evt) {
|
||||||
$(this).html("").offset({top:0, left:0}).hide();
|
$(this).html("").offset({top:0, left:0}).hide();
|
||||||
@@ -119,7 +137,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function init_page() {
|
function init_page() {
|
||||||
var state = load_qs();
|
var qs = load_qs();
|
||||||
$(window).on("popstate", function(e) {
|
$(window).on("popstate", function(e) {
|
||||||
var oe = e.originalEvent;
|
var oe = e.originalEvent;
|
||||||
if (oe.state !== null) {
|
if (oe.state !== null) {
|
||||||
@@ -133,8 +151,8 @@
|
|||||||
update_weapon_list(state);
|
update_weapon_list(state);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (state) {
|
if (qs) {
|
||||||
update_weapon_list(state);
|
update_weapon_list(qs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,15 +169,26 @@
|
|||||||
"weapon_element": $("#weapon_element").val(),
|
"weapon_element": $("#weapon_element").val(),
|
||||||
"weapon_final": $("#weapon_final").is(":checked"),
|
"weapon_final": $("#weapon_final").is(":checked"),
|
||||||
"weapon_name_text": $("#weapon_name_text").val(),
|
"weapon_name_text": $("#weapon_name_text").val(),
|
||||||
"weapon_component_text": $("#weapon_component_text").val() };
|
"weapon_component_text": $("#weapon_component_text").val(),
|
||||||
|
"village_stars": $("#village_stars").val(),
|
||||||
|
"guild_stars": $("#guild_stars").val(),
|
||||||
|
"arena_stars": $("#arena_stars").val() };
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_state(state) {
|
function load_state(state) {
|
||||||
$("#weapon_type").val(state["weapon_type"]);
|
$("#weapon_type").val(state["weapon_type"]);
|
||||||
$("#weapon_element").val(state["weapon_element"]);
|
$("#weapon_element").val(state["weapon_element"]);
|
||||||
|
final = state["weapon_final"];
|
||||||
|
if (typeof final == "string") {
|
||||||
|
final = final.toLowerCase();
|
||||||
|
state["weapon_final"] = (final == "true" || final == "1");
|
||||||
|
}
|
||||||
$("#weapon_final").prop("checked", state["weapon_final"]);
|
$("#weapon_final").prop("checked", state["weapon_final"]);
|
||||||
$("#weapon_name_text").val(state["weapon_name_text"]);
|
$("#weapon_name_text").val(state["weapon_name_text"]);
|
||||||
$("#weapon_component_text").val(state["weapon_component_text"]);
|
$("#weapon_component_text").val(state["weapon_component_text"]);
|
||||||
|
$("#village_stars").val(state["village_stars"] || "Any");
|
||||||
|
$("#guild_stars").val(state["guild_stars"] || "Any");
|
||||||
|
$("#arena_stars").val(state["arena_stars"] || "Any");
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_state(state, replace) {
|
function save_state(state, replace) {
|
||||||
@@ -171,11 +200,58 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function match_stars(match_value, weapon_value) {
|
||||||
|
// NOTE: a null weapon_value can be not available, or no data
|
||||||
|
// available (should probably fix this)
|
||||||
|
if (match_value == "Any" || match_value == ""
|
||||||
|
|| match_value == undefined || match_value == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (match_value == "None") {
|
||||||
|
// for None, allow null values, because null can be no requirements
|
||||||
|
// or no data available
|
||||||
|
if (weapon_value != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// if matching a specific value, require a non-null weapon value
|
||||||
|
if (weapon_value == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
match_value = parseInt(match_value);
|
||||||
|
if (weapon_value > match_value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function weapon_predicate(state, weapon_data) {
|
function weapon_predicate(state, weapon_data) {
|
||||||
var weapon_type = state["weapon_type"];
|
var weapon_type = state["weapon_type"];
|
||||||
var weapon_element = state["weapon_element"];
|
var weapon_element = state["weapon_element"];
|
||||||
var final_only = state["weapon_final"];
|
var final_only = state["weapon_final"];
|
||||||
var weapon_names = state["weapon_name_text"].split("|");
|
var weapon_names = state["weapon_name_text"].split("|");
|
||||||
|
var village_stars = state["village_stars"];
|
||||||
|
var guild_stars = state["guild_stars"];
|
||||||
|
var arena_stars = state["arena_stars"];
|
||||||
|
|
||||||
|
// do this first to simplify debugging specific weapons that aren't
|
||||||
|
// matching when they should via breakpoints
|
||||||
|
if (weapon_names && !list_match(weapon_names, [weapon_data["name"]])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow satisfying quest filter with village or guild, since they
|
||||||
|
// involve essentially the same quests, rewards, and monsters,
|
||||||
|
// but if permit or arena filters are set, they must be satisfied
|
||||||
|
// independently
|
||||||
|
if (! match_stars(village_stars, weapon_data["village_stars"])
|
||||||
|
&& ! match_stars(guild_stars, weapon_data["guild_stars"])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (! match_stars(arena_stars, weapon_data["arena_stars"])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (final_only && weapon_data["final"] != 1) {
|
if (final_only && weapon_data["final"] != 1) {
|
||||||
return false;
|
return false;
|
||||||
@@ -188,17 +264,15 @@
|
|||||||
if (weapon_element != "All"
|
if (weapon_element != "All"
|
||||||
&& weapon_element != weapon_data["element"]
|
&& weapon_element != weapon_data["element"]
|
||||||
&& weapon_element != weapon_data["element_2"]
|
&& weapon_element != weapon_data["element_2"]
|
||||||
&& weapon_element != weapon_data["awaken"]) {
|
&& weapon_element != weapon_data["awaken"]
|
||||||
|
&& weapon_element != weapon_data["phial"]) {
|
||||||
if (weapon_element != "None"
|
if (weapon_element != "None"
|
||||||
|| weapon_data["element"] != "" || weapon_data["awaken"] != "") {
|
|| (weapon_data["element"] != null && weapon_data["element"] != "")
|
||||||
|
|| (weapon_data["awaken"] != null && weapon_data["awaken"] != "")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon_names && !list_match(weapon_names, [weapon_data["name"]])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,55 +293,43 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_weapon_list(state) {
|
function update_weapon_list(state) {
|
||||||
var match_count = 0;
|
|
||||||
var cp_setups = [];
|
|
||||||
var comps = state["weapon_component_text"];
|
var comps = state["weapon_component_text"];
|
||||||
if (comps) {
|
if (comps) {
|
||||||
comps = comps.split("|");
|
comps = comps.split("|");
|
||||||
}
|
}
|
||||||
|
var match_count = 0;
|
||||||
console.log("updating weapon list: " + JSON.stringify(state));
|
console.log("updating weapon list: " + JSON.stringify(state));
|
||||||
var results = [];
|
var results = [];
|
||||||
$.each(WEAPON_ID_IDX, function(weapon_id, weapon_list) {
|
$.each(WEAPON_LIST, function(i, weapon_data) {
|
||||||
var weapon_data = weapon_list[0];
|
|
||||||
if (weapon_predicate(state, weapon_data)) {
|
if (weapon_predicate(state, weapon_data)) {
|
||||||
$.ajax({
|
if (comps
|
||||||
url: DATA_PATH + "weapon/" + weapon_id + ".json",
|
&& !list_match(comps,
|
||||||
dataType: "json",
|
Object.keys(data["create_components"]))
|
||||||
async: false,
|
&& !list_match(comps,
|
||||||
success: function(data) {
|
Object.keys(data["upgrade_components"])))
|
||||||
if (comps
|
{
|
||||||
&& !list_match(comps,
|
console.log("skipping '" + data["name"]
|
||||||
Object.keys(data["create_components"]))
|
+ "', failed component match");
|
||||||
&& !list_match(comps,
|
return;
|
||||||
Object.keys(data["upgrade_components"])))
|
}
|
||||||
{
|
weapon_data["id"] = i;
|
||||||
console.log("skipping '" + data["name"]
|
weapon_data["sharpness_width"] = 1;
|
||||||
+ "', failed component match");
|
weapon_data["sharpness_plus2"] = null;
|
||||||
return;
|
weapon_data["url"] = "weaponplanner.html?weapon="
|
||||||
}
|
+ encodeURIComponent(weapon_data["name"]);
|
||||||
match_count += 1;
|
weapon_data["bug_type"] = null;
|
||||||
set_sharpness_titles(data);
|
weapon_data["arc_type"] = null;
|
||||||
data["arc_type"] = null;
|
match_count += 1;
|
||||||
data["sharpness_plus2"] = null;
|
set_sharpness_titles(weapon_data);
|
||||||
data["sharpness_width"] = 1;
|
set_bow_values(weapon_data);
|
||||||
data["bug_type"] = null;
|
set_horn_melodies_title(weapon_data, HORN_MELODY_MAP);
|
||||||
set_bow_values(data);
|
weapon_data["wtype_short"] =
|
||||||
set_horn_melodies_title(data);
|
WEAPON_TYPE_ABBR[weapon_data["wtype"]];
|
||||||
data["wtype_short"] = WEAPON_TYPE_ABBR[data["wtype"]];
|
weapon_data["ELEMENT_ABBR"] = ELEMENT_ABBR;
|
||||||
data["ELEMENT_ABBR"] = ELEMENT_ABBR;
|
var html = template_row.render(weapon_data);
|
||||||
data["url"] = null;
|
results.push([weapon_data, html]);
|
||||||
var html = template_row.render(data);
|
|
||||||
results.push([data, html]);
|
|
||||||
var setup = get_calculating_palico_setup(data);
|
|
||||||
//console.log("setup for " + weapon_id + ": " + setup);
|
|
||||||
if (setup.length) {
|
|
||||||
cp_setups.push(setup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("results len " + results.length);
|
|
||||||
results.sort(function (a, b) {
|
results.sort(function (a, b) {
|
||||||
avals = get_weapon_sort_values(a[0]);
|
avals = get_weapon_sort_values(a[0]);
|
||||||
bvals = get_weapon_sort_values(b[0]);
|
bvals = get_weapon_sort_values(b[0]);
|
||||||
@@ -277,23 +339,9 @@
|
|||||||
$.each(results, function(i, pair) {
|
$.each(results, function(i, pair) {
|
||||||
$("#weapon_table").append(pair[1]);
|
$("#weapon_table").append(pair[1]);
|
||||||
});
|
});
|
||||||
update_cp_link(cp_setups);
|
|
||||||
|
|
||||||
console.log("match count: " + match_count);
|
console.log("match count: " + match_count);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_cp_link(setups) {
|
|
||||||
if (setups.length == 0) {
|
|
||||||
console.log("no matches or no cp setups, hiding cp link");
|
|
||||||
$("#cp_div").hide();
|
|
||||||
} else {
|
|
||||||
var href = get_calculating_palico_uri(setups);
|
|
||||||
console.log("cp link: " + href);
|
|
||||||
$("#cp_link").prop("href", href);
|
|
||||||
$("#cp_div").show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -342,6 +390,48 @@
|
|||||||
<td><input id="weapon_final" type="checkbox" /></td>
|
<td><input id="weapon_final" type="checkbox" /></td>
|
||||||
<td><button id="search">Search</button></td>
|
<td><button id="search">Search</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="7">
|
||||||
|
<label>Quest Level:</label>
|
||||||
|
<select id="village_stars">
|
||||||
|
<option value="Any">Village Any</option>
|
||||||
|
<option value="1">Village 1*</option>
|
||||||
|
<option value="2">Village 2*</option>
|
||||||
|
<option value="3">Village 3*</option>
|
||||||
|
<option value="4">Village 4*</option>
|
||||||
|
<option value="5">Village 5*</option>
|
||||||
|
<option value="6">Village 6*</option>
|
||||||
|
<option value="7">Village 7*</option>
|
||||||
|
<option value="8">Village 8*</option>
|
||||||
|
<option value="9">Village 9*</option>
|
||||||
|
<option value="10">Village 10*</option>
|
||||||
|
</select>
|
||||||
|
<select id="guild_stars">
|
||||||
|
<option value="Any">Guild Any</option>
|
||||||
|
<option value="1">Guild 1*</option>
|
||||||
|
<option value="2">Guild 2*</option>
|
||||||
|
<option value="3">Guild 3*</option>
|
||||||
|
<option value="4">Guild 4*</option>
|
||||||
|
<option value="5">Guild 5*</option>
|
||||||
|
<option value="6">Guild 6*</option>
|
||||||
|
<option value="7">Guild 7*</option>
|
||||||
|
<option value="8">Guild 8*</option>
|
||||||
|
<option value="9">Guild 9*</option>
|
||||||
|
<option value="10">Guild 10*</option>
|
||||||
|
</select>
|
||||||
|
<select id="arena_stars">
|
||||||
|
<option value="Any">Arena Any</option>
|
||||||
|
<option value="None">Arena None</option>
|
||||||
|
<option value="1">Arena 1*</option>
|
||||||
|
<option value="2">Arena 2*</option>
|
||||||
|
<option value="3">Arena 3*</option>
|
||||||
|
<option value="4">Arena 4*</option>
|
||||||
|
<option value="5">Arena 5*</option>
|
||||||
|
<option value="6">Arena 6*</option>
|
||||||
|
<option value="7">Arena 7*</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="7">
|
<td colspan="7">
|
||||||
<label for="weapon_name_text"
|
<label for="weapon_name_text"
|
||||||
@@ -356,11 +446,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="cp_div">
|
|
||||||
<a id="cp_link"
|
|
||||||
href="http://minyoung.ch/calculatingpalico/"
|
|
||||||
>Compare damage (Calculating Palico)</a>
|
|
||||||
</div>
|
|
||||||
<table id="weapon_table">
|
<table id="weapon_table">
|
||||||
</table>
|
</table>
|
||||||
<div id="sharpness_popup"></div>
|
<div id="sharpness_popup"></div>
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/ejs_production.js"></script>
|
<script type="text/javascript" src="/js/ejs_production.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/common.js"></script>
|
<script type="text/javascript" src="/js/common.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
label {
|
label {
|
||||||
@@ -85,10 +85,10 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DATA_PATH = get_base_path() + "/jsonapi/";
|
var DATA_PATH = "/jsonapi/mh4u/";
|
||||||
|
|
||||||
var template_path = new EJS({ url: "templates/weaponpath.ejs" });
|
var template_path = new EJS({ url: "/templates/weaponpath.ejs" });
|
||||||
var template_stats = new EJS({ url: "templates/weaponstats.ejs" });
|
var template_stats = new EJS({ url: "/templates/weaponstats.ejs" });
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
setup_weapon_autocomplete("#weapon", autocomplete_predicate,
|
setup_weapon_autocomplete("#weapon", autocomplete_predicate,
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save_state(state, replace) {
|
function save_state(state, replace) {
|
||||||
var url = "/weaponplanner.html?" + encode_qs(state);
|
var url = "/mh4u/weaponplanner.html?" + encode_qs(state);
|
||||||
if (replace) {
|
if (replace) {
|
||||||
window.history.replaceState(state, "", url);
|
window.history.replaceState(state, "", url);
|
||||||
} else {
|
} else {
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show_trees(weapon_name) {
|
function show_trees(weapon_name) {
|
||||||
|
console.log("show_trees '" + weapon_name + "'");
|
||||||
if (!weapon_name) return;
|
if (!weapon_name) return;
|
||||||
weapon_id = WEAPON_NAME_IDX[weapon_name][0];
|
weapon_id = WEAPON_NAME_IDX[weapon_name][0];
|
||||||
console.log("show_trees(" + weapon_name + "): " + weapon_id);
|
console.log("show_trees(" + weapon_name + "): " + weapon_id);
|
||||||
@@ -180,14 +181,14 @@
|
|||||||
function(data) {
|
function(data) {
|
||||||
set_sharpness_titles(data);
|
set_sharpness_titles(data);
|
||||||
set_horn_melodies_title(data);
|
set_horn_melodies_title(data);
|
||||||
data["sharpness_plus2"] = null;
|
|
||||||
data["sharpness_width"] = 1;
|
|
||||||
if (data["parent_id"]) {
|
if (data["parent_id"]) {
|
||||||
var parent_obj = WEAPON_ID_IDX[data["parent_id"]][0];
|
var parent_obj = WEAPON_ID_IDX[data["parent_id"]][0];
|
||||||
data["parent_name"] = parent_obj["name"];
|
data["parent_name"] = parent_obj["name"];
|
||||||
} else {
|
} else {
|
||||||
data["parent_name"] = null;
|
data["parent_name"] = null;
|
||||||
}
|
}
|
||||||
|
data["sharpness_width"] = 1;
|
||||||
|
data["sharpness_plus2"] = null;
|
||||||
var html = template_stats.render(data);
|
var html = template_stats.render(data);
|
||||||
$("#weapon_stats").html(html);
|
$("#weapon_stats").html(html);
|
||||||
});
|
});
|
||||||
@@ -81,6 +81,17 @@
|
|||||||
title="<%= parent_name %>">(parent)</a>
|
title="<%= parent_name %>">(parent)</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
|
<% if (village_stars) { %>
|
||||||
|
<td>
|
||||||
|
Village <%= village_stars %>
|
||||||
|
</td>
|
||||||
|
<% } %>
|
||||||
|
<% if (guild_stars) { %>
|
||||||
|
<td>
|
||||||
|
Guild <%= guild_stars %>
|
||||||
|
</td>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<% if (children.length) { %>
|
<% if (children.length) { %>
|
||||||
|
|||||||
Reference in New Issue
Block a user