'.get_item_edit_form($item).'

Debug Output

'.print_r($item,1).'
'; } // Get item icons by selected category. if(isset($_POST['get-item-icons'])) { require('inc/json.item.icons.php'); echo get_icon_picker($itemIcons, 'icons', $_POST['get-item-icons'], (isset($_POST['page']) ? $_POST['page']:1)); } /* GET FUNCTIONS */ function get_icon_picker($icons, $type = 'icons', $category = 'Adornment', $page = 1, $limit = 133, $return = NULL) { $pass = 0; if($type == 'categories') { $return .= ' '; foreach($icons as $c => $i) { $return .= ' '; $pass++; } $return .= ''; } else { $from = ($limit*$page)-$limit; $to = ($limit*$page); $pass++; if($category == 'all') { $ico = []; foreach($icons as $c => $v) { foreach($v['icons'] as $i) { if(!in_array($i, $ico)) { $ico[] = $i; } } } } else { $ico = $icons[$category]['icons']; } $pass = 0; foreach($ico as $k => $i) { if(($pass >= $from) && ($pass+1 <= $to)) { $return .= '
'; } $pass++; } } $pagination = ($type == 'icons' ? '
'.ico_pagination($category, $page, $limit, count($ico)).'
':NULL); return $pagination.$return; } //Generates pagination for icons. function ico_pagination($category, $p, $limit, $count, $return = NULL) { $return .= ''; $page_count = ceil($count/$limit); if($page_count > 1) { if(($p-5) > 1) { $return .= ''; } for ($k = 1 ; $k <= $page_count; $k++){ if(($k >= ($p-5)) && ($k <= ($p+5))) { $return .= ' '; } } if(($p+5) < $page_count) { $return .= ''; } } else { $return .= ' '; } $return .= ' '; return $return; } //Global function to build editable inputs. (WIP) function build_edit_input($e, $return = NULL) { if(!isset($e['type'])) { $e['type'] = 'text'; } if(!isset($e['field_type'])) { $return = '
'.($e['icon'] ? '':NULL).' '.$e['title'].'
'; } else { if($e['field_type'] == 'textarea') { $return = '
'.($e['icon'] ? '':NULL).' '.$e['title'].'
'.($e['desc'] ? $e['desc']:NULL).'
'; } else if($e['field_type'] == 'select') { $return = '
'.($e['icon'] ? '':NULL).' '.$e['title'].'
'.($e['desc'] ? $e['desc']:NULL).'
'; } else if($e['field_type'] == 'switch') { $return = '
'.($e['desc'] ? ''.$e['desc'].'':NULL); } } return $return; } $exclude_debug_fieldlist = [ 'icon','id','name','item_type','lore','temporary','artifact','notrade','nodestroy','show_name', 'crafted' ]; //Convert array to select option values with option to exclude a pre-selected value. function array_to_options($a, $preselected = NULL, $return = NULL) { foreach($a as $k => $v) { if($preselected != $v) { $return .= ' '; } } return $return; } // Builds list of item skills in option format function get_skills($skill_ids = [], $return = NULL) { global $world; $query = ' SELECT s.* FROM skills AS s WHERE s.`id` IN(1743366740,1756482397,3587918036,3539032716,1386343008,1039865549,4032608519,3330500131,2072844078,1408356869,2650425026,2639209773)'; //The listed ID's appeared in no original items that were listed as skill requirements. } // Builds item edit form inputs & form. - Deprecated! Only for debugging. function get_item_edit_form($item, $return = NULL) { global $exclude_debug_fieldlist; $pass = 0; foreach($item as $k => $v) { if(!in_array($k,$exclude_debug_fieldlist)) { $return .= '
'.$k.'
 
'; } } return $return; } // Get Item Data function get_item_data($id, $return = []) { global $world; $query = ' SELECT i.`id`, i.`name`, i.`item_type`, i.`icon`, i.`count`, i.`tier`, i.`skill_id_req`, i.`skill_id_req2`, i.`skill_min`, i.`weight`, i.`description`, i.`show_name`, i.`attuneable`, i.`artifact`, i.`lore`, i.`temporary`, i.`notrade`, i.`novalue`, i.`nozone`, i.`nodestroy`, i.`crafted`, i.`good_only`, i.`evil_only`, i.`stacklore`, i.`lore_equip`, i.`flags_16384`, i.`flags_32768`, i.`ornate`, i.`heirloom`, i.`appearance_only`, i.`unlocked`, i.`reforged`, i.`norepair`, i.`etheral`, i.`refined`, i.`flags2_256`, i.`usable`, i.`slots`, i.`set_name`, i.`sell_price`, i.`sell_status_amount`, i.`stack_count`, i.`collectable`, i.`adornment_slot1`, i.`adornment_slot2`, i.`adornment_slot3`, i.`adornment_slot4`, i.`adornment_slot5`, i.`adornment_slot6`, i.`adornment_description`, i.`offers_quest_id`, i.`soe_autoquest_id`, i.`part_of_quest_id`, i.`quest_unknown`, i.`max_charges`, i.`display_charges`, i.`recommended_level`, i.`adventure_default_level`, i.`tradeskill_default_level`, i.`adventure_classes`, i.`tradeskill_classes`, i.`soe_item_id`, i.`soe_item_crc`, i.`lua_script`, i.`harvest` FROM `items` as `i` WHERE `i`.`id` = '.addslashes($id); $stmt = $world->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $return = $row; return $return; } // Quick Item Search function quick_item_search($s, $limit = 100, $page = 0, $return = []) { global $world; $return = [ 'found' => 0, 'count' => 0, 'rows' => [], 'limit' => $limit, 'page' => $page ]; $query = ' SELECT SQL_CALC_FOUND_ROWS i.`id`, i.`name`, i.`item_type`, i.`icon` FROM `items` as `i` WHERE i.`id` = \''.addslashes($s).'\' OR i.`name` LIKE \'%'.addslashes(str_replace(' ', '%%',$s)).'%\' OR LOWER(i.`item_type`) = LOWER(\''.addslashes($s).'\') LIMIT '.$limit; //error_log($query,1); $stmt = $world->prepare($query); $stmt->execute(); $rc = $stmt->rowCount(); if($rc > 0) { $return['found'] = get_found_count(); $return['count'] = $rc; while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $return['rows'][] = $row; } } return $return; } //Returns count of rows found (if LIMIT had not been used). //Note: Requires SQL_CALC_FOUND_ROWS after SELECT. function get_found_count() { global $world; $query = 'SELECT FOUND_ROWS() as `found`;'; $stmt = $world->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); return $row['found']; } //Returns count of characters. function get_character_count($return = 0) { global $world; $query = 'SELECT count(DISTINCT `id`) as `count` FROM `characters`'; $stmt = $world->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $return = $row['count']; return $return; } //Get World Information. function get_world_info($world_name = NULL, $return = []) { global $_db, $login; $world_name = ($world_name == NULL ? _world:$world_name); $query = ' SELECT w.id, w.name, w.disabled, w.account, w.description, w.password, w.serverop, w.greenname, w.note, w.ip_address, w.login_version, DATE_FORMAT(FROM_UNIXTIME(w.lastseen), "%m/%d/%y %h:%i %p") AS `lastseen` FROM login_worldservers AS w WHERE w.name = \''.$world_name.'\''; $stmt = $login->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $return = $row; return $return; } //Pulls variable data from world db. function get_world_variables($return = []) { global $world; $query = ' SELECT v.variable_name, v.variable_value, v.comment FROM variables as v'; $stmt = $world->prepare($query); $stmt->execute(); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $return[$row['variable_name']] = [ 'value' => $row['variable_value'], 'desc' => $row['comment'] ]; } return $return; } /* UTILITY FUNCTIONS */ // Loads HTML output for left navigation menu. function get_nav_menu($return = NULL) { global $_modules, $_SESSION; $active = $_SESSION[_sid]['view']; foreach($_modules as $k => $m) { $access = !empty(array_intersect($_SESSION[_sid]['user']['access'], $m['access'])); if($access) { if($m['type'] == 'module') { $return .= ' '; } else if($m['type'] == 'category') { $return .= ' '; } } } return $return; } ?>