diff --git a/mhapi/model.py b/mhapi/model.py
index 3799710..8eed700 100644
--- a/mhapi/model.py
+++ b/mhapi/model.py
@@ -312,7 +312,11 @@ class Skill(RowModel):
class Weapon(RowModel):
_list_fields = ["id", "wtype", "name"]
_indexes = { "name": "id",
- "wtype": ["id", "name"] }
+ "wtype": ["id", "name"],
+ # subset of all data that can be used for searching and
+ # not be too bloated
+ "id": ["name", "wtype", "final", "element", "element_2",
+ "awaken"] }
def __init__(self, weapon_item_row):
super(Weapon, self).__init__(weapon_item_row)
diff --git a/web/img/Blastblight.png b/web/img/Blastblight.png
new file mode 100644
index 0000000..2503fc8
Binary files /dev/null and b/web/img/Blastblight.png differ
diff --git a/web/img/Dragon.png b/web/img/Dragon.png
new file mode 100644
index 0000000..7a1dc44
Binary files /dev/null and b/web/img/Dragon.png differ
diff --git a/web/img/Fire.png b/web/img/Fire.png
new file mode 100644
index 0000000..5cc90b5
Binary files /dev/null and b/web/img/Fire.png differ
diff --git a/web/img/Ice.png b/web/img/Ice.png
new file mode 100644
index 0000000..dabf844
Binary files /dev/null and b/web/img/Ice.png differ
diff --git a/web/img/Paralysis.png b/web/img/Paralysis.png
new file mode 100644
index 0000000..cff1f23
Binary files /dev/null and b/web/img/Paralysis.png differ
diff --git a/web/img/Poison.png b/web/img/Poison.png
new file mode 100644
index 0000000..022b7e9
Binary files /dev/null and b/web/img/Poison.png differ
diff --git a/web/img/Sleep.png b/web/img/Sleep.png
new file mode 100644
index 0000000..ab8913d
Binary files /dev/null and b/web/img/Sleep.png differ
diff --git a/web/img/Thunder.png b/web/img/Thunder.png
new file mode 100644
index 0000000..fffbc9b
Binary files /dev/null and b/web/img/Thunder.png differ
diff --git a/web/img/Water.png b/web/img/Water.png
new file mode 100644
index 0000000..fd13eac
Binary files /dev/null and b/web/img/Water.png differ
diff --git a/web/index.html b/web/index.html
index a220ea2..c9bd782 100644
--- a/web/index.html
+++ b/web/index.html
@@ -10,10 +10,29 @@
+
+
+
+
+
+
+
diff --git a/web/weaponplanner.html b/web/weaponplanner.html
index 4c48483..4fd861b 100644
--- a/web/weaponplanner.html
+++ b/web/weaponplanner.html
@@ -91,7 +91,7 @@
var template_stats = new EJS({ url: "templates/weaponstats.ejs" });
$(document).ready(function(){
- setup_weapon_autocomplete("#weapon_type", "#weapon",
+ setup_weapon_autocomplete("#weapon", autocomplete_predicate,
init_page, update_search);
});
@@ -107,6 +107,11 @@
show_trees(oe.state["weapon"]);
}
});
+ $("#weapon_type").change(function(evt) {
+ update_weapon_autocomplete("#weapon", autocomplete_predicate,
+ update_search);
+ $("#weapon").val("");
+ });
}
function load_qs() {
@@ -120,12 +125,16 @@
if (weapon) {
show_trees(weapon);
console.log("replaceState: " + weapon);
- set_state(wtype, weapon, true);
+ save_state(get_state(), true);
}
}
- function set_state(weapon_type, weapon, replace) {
- var state = { "weapon": weapon, "weapon_type": weapon_type };
+ function get_state() {
+ return { "weapon": $("#weapon").val(),
+ "weapon_type": $("#weapon_type").val() };
+ }
+
+ function save_state(state, replace) {
var url = "/weaponplanner.html?" + encode_qs(state);
if (replace) {
window.history.replaceState(state, "", url);
@@ -134,20 +143,30 @@
}
}
+ function autocomplete_predicate(weapon_data) {
+ var weapon_type = $("#weapon_type").val();
+
+ if (weapon_type != "All" && weapon_type != weapon_data["wtype"]) {
+ return false;
+ }
+
+ return true;
+ }
+
function update_search() {
var weapon_name = $("#weapon").val();
- var wtype = $("#weapon_type").val();
if (!weapon_name) return;
- if (window.history.state["weapon"] == weapon_name) {
+ if (window.history.state
+ && window.history.state["weapon"] == weapon_name) {
console.log("weapon not changed, skipping update");
return;
}
show_trees(weapon_name);
console.log("pushState: " + weapon_name);
- set_state(wtype, weapon_name, false);
+ save_state(get_state(), false);
}
function show_trees(weapon_name) {
@@ -164,7 +183,7 @@
var html = template_stats.render(data);
$("#weapon_stats").html(html);
});
-
+
$.getJSON(DATA_PATH + "weapon/" + weapon_id + "_tree.json",
function(data) {
// first pass: collect all components and sort them
@@ -217,8 +236,8 @@