$npc_fields["Visual Texture"][$field_name][0] = $npc_cols[$n - 1] . ''; $npc_fields["Visual Texture"][$field_name][1] = '<a href="javascript:;" onclick="OpenWindow(\'min.php?Mod=IE&prevITfile=1&Field=' . $field_name . '&NPC=' . $row['id'] . '\', \'_blank\', 900, 900)"> <span class="image-wrap " style="width: auto; height: auto;"> <img src="includes/img.php?type=weaponimage&id=' . $val . '" id="' . $field_name . '" class="embossed morphing-glowing"> </span> </a> '; $npc_fields["Visual Texture"][$field_name][1] .= "<input type='number' title='" . ProcessFieldTitle($field_name) . "' value='" . $val . "' id='" . $row['id'] . "^" . $field_name . "' class='" . $field_name . "' onchange='update_npc_field(" . $row['id'] . ", \"" . $field_name . "\", this.value)'>"; } else { if ($Custom_Select_Fields[$field_name]) { $npc_fields[$field_category[$field_name]][$field_name][0] = $npc_cols[$n - 1]; $npc_fields[$field_category[$field_name]][$field_name][1] = GetFieldSelect($field_name, $val, $row['id']); } else { if ($field_category[$field_name][0]) { $npc_fields[$field_category[$field_name]][$field_name][0] = $npc_cols[$n - 1]; $npc_fields[$field_category[$field_name]][$field_name][1] = "<input type='text' value='" . $val . "' id='" . $row['id'] . "^" . $field_name . "' class='" . $field_name . "' onchange='update_npc_field(" . $row['id'] . ", \"" . $field_name . "\", this.value)' title='" . ProcessFieldTitle($field_name) . "'>"; } else { $npc_fields['End'][$field_name][0] = $npc_cols[$n - 1]; $npc_fields['End'][$field_name][1] = "<input type='text' value='" . $val . "' id='" . $row['id'] . "^" . $field_name . "' class='" . $field_name . "' onchange='update_npc_field(" . $row['id'] . ", \"" . $field_name . "\", this.value)' >"; } } } } $n++; } } } $category_order = array("General", "Visual Texture", "Combat", "Appearance", "Statistics", "Misc."); $td_content = ""; $n = 0; /* Manually push this field into the Appearance Category */
function GetFieldSelect($field_name, $value, $npc_id, $from_npc_grid_tool = 0) { global $edit_options, $yes_no, $trap_types, $adventure_templates, $bodytypes, $genders, $dbclasses, $dbiracenames; $found_select = 0; $ret .= "<select class='form-control' title='" . ProcessFieldTitle($field_name) . "' value='" . $value . "' id='" . $npc_id . "^" . $field_name . "' class='" . $field_name . "' onchange='update_npc_field(" . $npc_id . ", \"" . $field_name . "\", this.value)'>"; if ($field_name == "prim_melee_type" || $field_name == "sec_melee_type") { foreach ($edit_options['extradmgskill'] as $key => $val) { if ($key == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $key . '" ' . $sel . '>' . $key . ': ' . $val . '</option>'; } $found_select = 1; } else { if ($field_name == "race") { for ($i = 1; $i < 700; $i++) { if ($dbiracenames[$i]) { if ($i == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $i . '" ' . $sel . '>' . $i . ': ' . $dbiracenames[$i] . '</option>'; } } $found_select = 1; } else { if ($field_name == "adventure_template_id") { $ret .= '<option value="0">0: None</option>'; foreach ($adventure_templates as $key => $val) { if ($key == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $key . '" ' . $sel . '>' . $key . ': ' . $val . '</option>'; } $found_select = 1; } else { if ($field_name == "class") { $ret .= '<option value="0">0: None</option>'; foreach ($dbclasses as $key => $val) { if ($key == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $key . '" ' . $sel . '>' . $key . ': ' . $val . '</option>'; } $found_select = 1; } else { if ($field_name == "gender") { $ret .= '<option value="0">0: None</option>'; foreach ($genders as $key => $val) { if ($key == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $key . '" ' . $sel . '>' . $key . ': ' . $val . '</option>'; } $found_select = 1; } else { if ($field_name == "bodytype") { $ret .= '<option value="0">0: None</option>'; foreach ($bodytypes as $key => $val) { if ($key == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $key . '" ' . $sel . '>' . $key . ': ' . $val . '</option>'; } $found_select = 1; } else { if ($field_name == "size") { for ($i = 1; $i <= 255; $i++) { if ($i == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $i . '" ' . $sel . '>' . $i . '</option>'; } $found_select = 1; } else { if ($field_name == "emoteid") { $query = "SELECT * FROM `npc_emotes`"; $result = mysql_query($query); $eid_data = array(); $ret .= '<option value="0">0: None</option>'; while ($row = mysql_fetch_array($result)) { if ($row['emoteid'] == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $row['emoteid'] . '" ' . $sel . '>' . $row['emoteid'] . ': ' . (strlen($row['text']) > 100 ? substr($row['text'], 0, 100) . '...' : $row['text']) . '</option>'; $found_select = 1; } } else { if ($field_name == "armortint_id") { $query = "SELECT * FROM `npc_types_tint` order by `id`"; $result = mysql_query($query); $eid_data = array(); $ret .= '<option value="0">0: None</option>'; while ($row = mysql_fetch_array($result)) { if ($row['id'] == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $row['id'] . '" ' . $sel . '>' . $row['id'] . ': ' . $row['tint_set_name'] . '</option>'; $found_select = 1; } } else { if ($field_name == "npc_spells_id") { $query = "SELECT * FROM `npc_spells` order by `id`"; $result = mysql_query($query); $eid_data = array(); $ret .= '<option value="0">0: None</option>'; while ($row = mysql_fetch_array($result)) { if ($row['id'] == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $row['id'] . '" ' . $sel . '>' . $row['id'] . ': ' . $row['name'] . '</option>'; } $found_select = 1; } else { if ($field_name == "npc_faction_id") { $query = "SELECT * FROM `npc_faction` order by `id`"; $result = mysql_query($query); $eid_data = array(); $ret .= '<option value="0">0: None</option>'; while ($row = mysql_fetch_array($result)) { if ($row['id'] == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $row['id'] . '" ' . $sel . '>' . $row['id'] . ': ' . $row['name'] . '</option>'; } $found_select = 1; } else { if ($field_name == "trap_template") { $query = "SELECT\n\t\t\t\tldon_trap_templates.id,\n\t\t\t\tldon_trap_templates.type,\n\t\t\t\tldon_trap_templates.spell_id,\n\t\t\t\tldon_trap_templates.skill,\n\t\t\t\tldon_trap_templates.locked,\n\t\t\t\tspells_new.`name`\n\t\t\t\tFROM\n\t\t\t\tldon_trap_templates\n\t\t\t\tINNER JOIN spells_new ON ldon_trap_templates.spell_id = spells_new.id\n\t\t\t\torder by ldon_trap_templates.id\n\t\t\t\t"; $result = mysql_query($query); $eid_data = array(); $ret .= '<option value="0">0: None</option>'; while ($row = mysql_fetch_array($result)) { if ($row['id'] == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $row['id'] . '" ' . $sel . '>' . $row['id'] . ': ' . $trap_types[$row['type']] . ' Spell: ' . $row['name'] . '</option>'; } $found_select = 1; } else { if ($field_name == "alt_currency_id") { $query = "SELECT\n\t\t\t\talternate_currency.id,\n\t\t\t\talternate_currency.item_id,\n\t\t\t\titems.`Name`\n\t\t\t\tFROM\n\t\t\t\talternate_currency\n\t\t\t\tINNER JOIN items ON alternate_currency.item_id = items.id\n\t\t\t\tORDER BY `id`\n\t\t\t\t"; $result = mysql_query($query); $eid_data = array(); $ret .= '<option value="0">0: None</option>'; while ($row = mysql_fetch_array($result)) { if ($row['id'] == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $row['id'] . '" ' . $sel . '>' . $row['id'] . ': ' . $row['Name'] . '</option>'; } $found_select = 1; } else { if ($field_name == "npc_aggro" || $field_name == "qglobal" || $field_name == "isbot" || $field_name == "trackable" || $field_name == "findable" || $field_name == "isquest" || $field_name == "see_improved_hide" || $field_name == "see_hide") { for ($i = 0; $i <= 1; $i++) { if ($i == $value) { $sel = "selected"; } else { $sel = ""; } $ret .= '<option value="' . $i . '" ' . $sel . '>' . $i . ': ' . $yes_no[$i] . '</option>'; } $found_select = 1; } } } } } } } } } } } } } } if ($found_select == 0 && $from_npc_grid_tool) { return ""; } $ret .= '</select>'; return $ret; }