/** * Build Recipes * * @return string */ function show_recipes() { global $roster, $sort, $addon; $roster->tpl->assign_vars(array('S_RECIPE_HIDE' => $addon['config']['recipe_disp'], 'U_ITEM' => makelink('char-info-recipes&s=item'), 'U_NAME' => makelink('char-info-recipes&s=name'), 'U_DIFFICULTY' => makelink('char-info-recipes&s=difficulty'), 'U_TYPE' => makelink('char-info-recipes&s=type'), 'U_LEVEL' => makelink('char-info-recipes&s=level'), 'U_REAGENTS' => makelink('char-info-recipes&s=reagents'))); $recipes = recipe_get_many($this->data['member_id'], '', $sort); if (isset($recipes[0])) { $recipe_arr = array(); foreach ($recipes as $object) { $skill = $object->data['skill_name']; $recipe = $object->data['recipe_name']; $recipe_arr[$skill][$recipe]['recipe_type'] = $object->data['recipe_type']; $recipe_arr[$skill][$recipe]['difficulty'] = $object->data['difficulty']; $recipe_arr[$skill][$recipe]['item_color'] = $object->data['item_color']; $recipe_arr[$skill][$recipe]['reagents'] = $object->data['reagents']; $recipe_arr[$skill][$recipe]['recipe_texture'] = $object->data['recipe_texture']; $recipe_arr[$skill][$recipe]['level'] = $object->data['level']; $recipe_arr[$skill][$recipe]['item_id'] = $object->data['item_id']; $recipe_arr[$skill][$recipe]['recipe_id'] = $object->data['recipe_id']; $recipe_arr[$skill][$recipe]['item'] = $object->out(); } foreach ($recipe_arr as $skill_name => $recipe) { $roster->tpl->assign_block_vars('recipe', array('ID' => strtolower(str_replace(' ', '', $skill_name)), 'NAME' => $skill_name, 'ICON' => $this->locale['ts_iconArray'][$skill_name], 'LINK' => makelink('#' . strtolower(str_replace(' ', '', $skill_name))))); foreach ($recipe as $name => $data) { if ($data['difficulty'] == '4') { $difficultycolor = 'FF9900'; } elseif ($data['difficulty'] == '3') { $difficultycolor = 'FFFF66'; } elseif ($data['difficulty'] == '2') { $difficultycolor = '339900'; } elseif ($data['difficulty'] == '1') { $difficultycolor = 'CCCCCC'; } else { $difficultycolor = 'FFFF80'; } $roster->tpl->assign_block_vars('recipe.row', array('ROW_CLASS' => $roster->switch_row_class(), 'DIFFICULTY' => $data['difficulty'], 'L_DIFFICULTY' => $roster->locale->act['recipe_' . $data['difficulty']], 'ITEM_COLOR' => $data['item_color'], 'NAME' => $name, 'DIFFICULTY_COLOR' => $difficultycolor, 'TYPE' => $data['recipe_type'], 'LEVEL' => $data['level'], 'REAGENTS' => str_replace('<br>', ' <br /> ', $data['reagents']), 'ICON' => $data['item'])); $reagents = explode('<br>', $data['reagents']); foreach ($reagents as $reagent) { $roster->tpl->assign_block_vars('recipe.row.reagents', array('DATA' => $reagent)); } } } } $roster->tpl->set_filenames(array('recipes' => $addon['basename'] . '/recipes.html')); return $roster->tpl->fetch('recipes'); }
/** * Build Recipes * * @return string */ function show_recipes() { global $roster, $addon; $roster->tpl->assign_vars(array('S_RECIPE_HIDE' => !(bool) $addon['config']['recipe_disp'], 'U_ITEM' => makelink('char-info-recipes&s=item'), 'U_NAME' => makelink('char-info-recipes&s=name'), 'U_DIFFICULTY' => makelink('char-info-recipes&s=difficulty'), 'U_TYPE' => makelink('char-info-recipes&s=type'), 'U_LEVEL' => makelink('char-info-recipes&s=level'), 'U_REAGENTS' => makelink('char-info-recipes&s=reagents'))); // Get recipe sort mode $sort = isset($_GET['s']) ? $_GET['s'] : ''; $recipes = recipe_get_many($this->data['member_id'], '', $sort); $reagents = recipe_get_regents($this->data['member_id']); $reagent_arr = array(); foreach ($reagents as $objects) { $skil = $objects->data['reagent_id']; $reagent_arr[$skil]['item_color'] = $objects->data['reagent_color']; $reagent_arr[$skil]['item_texture'] = $objects->data['reagent_texture']; $reagent_arr[$skil]['item_id'] = $objects->data['reagent_id']; $reagent_arr[$skil]['item_name'] = $objects->data['reagent_name']; $reagent_arr[$skil]['tooltip'] = $objects->data['reagent_tooltip']; } $recipexx = array(); //$recipeee = new recipe(); foreach ($recipes as $idx => $data) { if (isset($data['recipe_sub_type']) && !empty($data['recipe_sub_type'])) { $skill = $data['skill_name']; $type = $data['recipe_type']; $subtype = $data['recipe_sub_type']; $recipe = $data['recipe_name']; $recipeee = new recipe($data); $recipexx[$skill][$type][$subtype]["sub"] = true; $recipexx[$skill][$type][$subtype][$recipe]['recipe_type'] = $data['recipe_type']; $recipexx[$skill][$type][$subtype][$recipe]['difficulty'] = $data['difficulty']; $recipexx[$skill][$type][$subtype][$recipe]['item_color'] = $data['item_color']; $recipexx[$skill][$type][$subtype][$recipe]['reagents'] = $data['reagents']; $recipexx[$skill][$type][$subtype][$recipe]['recipe_texture'] = $data['recipe_texture']; $recipexx[$skill][$type][$subtype][$recipe]['level'] = $data['level']; $recipexx[$skill][$type][$subtype][$recipe]['item_id'] = $data['item_id']; $recipexx[$skill][$type][$subtype][$recipe]['recipe_id'] = $data['recipe_id']; $recipexx[$skill][$type][$subtype][$recipe]['icon'] = $roster->config['interface_url'] . 'Interface/Icons/' . $data['recipe_texture'] . '.' . $roster->config['img_suffix']; //$data->tpl_get_icon(); $recipexx[$skill][$type][$subtype][$recipe]['tooltip'] = makeOverlib($data['recipe_tooltip'], '', $data['item_color'], 0, $roster->config['locale']); $recipexx[$skill][$type][$subtype][$recipe]['itemlink'] = $recipeee->tpl_get_itemlink(); $recipexx[$skill][$type][$subtype][$recipe]['quality'] = $recipeee->_setQuality($data['item_color']); } else { $skill = $data['skill_name']; $type = $data['recipe_type']; $recipe = $data['recipe_name']; $recipeee = new recipe($data); $recipexx[$skill][$type][$recipe]['recipe_type'] = $data['recipe_type']; $recipexx[$skill][$type][$recipe]['difficulty'] = $data['difficulty']; $recipexx[$skill][$type][$recipe]['item_color'] = $data['item_color']; $recipexx[$skill][$type][$recipe]['reagents'] = $data['reagents']; $recipexx[$skill][$type][$recipe]['recipe_texture'] = $data['recipe_texture']; $recipexx[$skill][$type][$recipe]['level'] = $data['level']; $recipexx[$skill][$type][$recipe]['item_id'] = $data['item_id']; $recipexx[$skill][$type][$recipe]['recipe_id'] = $data['recipe_id']; $recipexx[$skill][$type][$recipe]['icon'] = $roster->config['interface_url'] . 'Interface/Icons/' . $data['recipe_texture'] . '.' . $roster->config['img_suffix']; //$data->tpl_get_icon(); $recipexx[$skill][$type][$recipe]['tooltip'] = makeOverlib($data['recipe_tooltip'], '', $data['item_color'], 0, $roster->config['locale']); $recipexx[$skill][$type][$recipe]['itemlink'] = $recipeee->tpl_get_itemlink(); $recipexx[$skill][$type][$recipe]['quality'] = $recipeee->_setQuality($data['item_color']); } } foreach ($recipexx as $skill_name => $header) { $roster->tpl->assign_block_vars('recipe', array('ID' => strtolower(str_replace(' ', '', $skill_name)), 'NAME' => $skill_name, 'ICON' => $this->locale['ts_iconArray'][$skill_name], 'TOOLTIP' => makeOverlib($skill_name, '', '', 1, '', ',WRAP'), 'LINK' => makelink('#' . strtolower(str_replace(' ', '', $skill_name))))); foreach ($header as $hname => $recipe) { $roster->tpl->assign_block_vars('recipe.header', array('NAME' => $hname)); foreach ($recipe as $name => $data) { if (isset($data['sub'])) { $roster->tpl->assign_block_vars('recipe.header.subheader', array('NAME' => $name)); foreach ($data as $s => $dat) { if ($s != 'sub') { $roster->tpl->assign_block_vars('recipe.header.subheader.rows', array('ROW_CLASS' => $roster->switch_row_class(), 'DIFFICULTY' => $dat['difficulty'], 'L_DIFFICULTY' => $roster->locale->act['recipe_' . $dat['difficulty']], 'ITEM_COLOR' => $dat['item_color'], 'NAME' => $s, 'DIFFICULTY_COLOR' => $this->diff($dat['difficulty']), 'TYPE' => $dat['recipe_type'], 'LEVEL' => $dat['level'], 'ICON' => $dat['icon'], 'TOOLTIP' => $dat['tooltip'], 'ITEMLINK' => $dat['itemlink'], 'QUALITY' => $dat['quality'])); $reagents = explode('|', $dat['reagents']); if (is_array($reagents)) { foreach ($reagents as $reagent) { $dtr = explode(':', $reagent); if (empty($dtr[0])) { $roster->tpl->assign_block_vars('recipe.header.subheader.rows.reagents', array('DATA' => $reagent, 'ID' => '000', 'NAME' => 'Missing', 'ITEM_COLOR' => '000000', 'QUALITY' => recipe::getQualityName('ffffff'), 'COUNT' => '0', 'ICON' => 'inv_misc_questionmark', 'TOOLTIP' => makeOverlib('Missing data', '', '', 0, $this->data['clientLocale'], ',RIGHT'))); } else { $roster->tpl->assign_block_vars('recipe.header.subheader.rows.reagents', array('DATA' => $reagent, 'ID' => $reagent_arr[$dtr[0]]['item_id'], 'NAME' => $reagent_arr[$dtr[0]]['item_name'], 'ITEM_COLOR' => $reagent_arr[$dtr[0]]['item_color'], 'QUALITY' => recipe::getQualityName($reagent_arr[$dtr[0]]['item_color']), 'COUNT' => $dtr[1], 'ICON' => $reagent_arr[$dtr[0]]['item_texture'], 'TOOLTIP' => makeOverlib($reagent_arr[$dtr[0]]['tooltip'], '', '', 0, $this->data['clientLocale'], ',RIGHT'))); } } } } } } else { $roster->tpl->assign_block_vars('recipe.header.row', array('ROW_CLASS' => $roster->switch_row_class(), 'DIFFICULTY' => $this->diff($data['difficulty']), 'L_DIFFICULTY' => $roster->locale->act['recipe_' . $data['difficulty']], 'ITEM_COLOR' => $data['item_color'], 'NAME' => $name, 'DIFFICULTY_COLOR' => $this->diff($data['difficulty']), 'TYPE' => $data['recipe_type'], 'LEVEL' => $data['level'], 'ICON' => $data['icon'], 'TOOLTIP' => $data['tooltip'], 'ITEMLINK' => $data['itemlink'], 'QUALITY' => $data['quality'])); $reagents = explode('|', $data['reagents']); //echo $name.'<br>'; if (is_array($reagents)) { //print_r($reagents); //echo '<pre><br>'; foreach ($reagents as $reagent) { $dtr = explode(':', $reagent); if (empty($dtr[0])) { $roster->tpl->assign_block_vars('recipe.header.row.reagents', array('DATA' => $reagent, 'ID' => '000', 'NAME' => 'Missing', 'ITEM_COLOR' => '000000', 'QUALITY' => recipe::getQualityName('ffffff'), 'COUNT' => '0', 'ICON' => 'inv_misc_questionmark', 'TOOLTIP' => makeOverlib('Missing data', '', '', 0, $this->data['clientLocale'], ',RIGHT'))); } else { $roster->tpl->assign_block_vars('recipe.header.row.reagents', array('DATA' => $reagent, 'ID' => $reagent_arr[$dtr[0]]['item_id'], 'NAME' => $reagent_arr[$dtr[0]]['item_name'], 'ITEM_COLOR' => $reagent_arr[$dtr[0]]['item_color'], 'QUALITY' => recipe::getQualityName($reagent_arr[$dtr[0]]['item_color']), 'COUNT' => $dtr[1], 'ICON' => $reagent_arr[$dtr[0]]['item_texture'], 'TOOLTIP' => makeOverlib($reagent_arr[$dtr[0]]['tooltip'], '', '', 0, $this->data['clientLocale'], ',RIGHT'))); } } } } } } } /* if (isset($recipes[0])) { $recipe_arr = array(); foreach ($recipes as $object) { $skill = $object->data['skill_name']; $recipe = $object->data['recipe_name']; $recipe_arr[$skill][$recipe]['recipe_type'] = $object->data['recipe_type']; $recipe_arr[$skill][$recipe]['difficulty'] = $object->data['difficulty']; $recipe_arr[$skill][$recipe]['item_color'] = $object->data['item_color']; $recipe_arr[$skill][$recipe]['reagents'] = $object->data['reagents']; $recipe_arr[$skill][$recipe]['recipe_texture'] = $object->data['recipe_texture']; $recipe_arr[$skill][$recipe]['level'] = $object->data['level']; $recipe_arr[$skill][$recipe]['item_id'] = $object->data['item_id']; $recipe_arr[$skill][$recipe]['recipe_id'] = $object->data['recipe_id']; $recipe_arr[$skill][$recipe]['icon'] = $object->tpl_get_icon(); $recipe_arr[$skill][$recipe]['tooltip'] = $object->tpl_get_tooltip(); $recipe_arr[$skill][$recipe]['itemlink'] = $object->tpl_get_itemlink(); $recipe_arr[$skill][$recipe]['quality'] = $object->quality; } // echo '<pre>'; // print_r($recipe_arr); foreach ($recipe_arr as $skill_name => $recipe) { $roster->tpl->assign_block_vars('recipe',array( 'ID' => strtolower(str_replace(' ','',$skill_name)), 'NAME' => $skill_name, 'ICON' => $this->locale['ts_iconArray'][$skill_name], 'TOOLTIP' => makeOverlib($skill_name,'','',1,'',',WRAP'), 'LINK' => makelink('#' . strtolower(str_replace(' ','',$skill_name))), ) ); foreach ($recipe as $name => $data) { switch ($data['difficulty']) { case 5 : $difficultycolor = 'red'; //difficult break; case 4 : $difficultycolor = 'orange'; //optimal break; case 3 : $difficultycolor = 'yellow'; //medium break; case 2 : $difficultycolor = 'green'; //easy break; case 1 : default : $difficultycolor = 'grey'; //trivial break; } $roster->tpl->assign_block_vars('recipe.row',array( 'ROW_CLASS' => $roster->switch_row_class(), 'DIFFICULTY' => $data['difficulty'], 'L_DIFFICULTY' => $roster->locale->act['recipe_' . $data['difficulty']], 'ITEM_COLOR' => $data['item_color'], 'NAME' => $name, 'DIFFICULTY_COLOR' => $difficultycolor, 'TYPE' => $data['recipe_type'], 'LEVEL' => $data['level'], 'ICON' => $data['icon'], 'TOOLTIP' => $data['tooltip'], 'ITEMLINK' => $data['itemlink'], 'QUALITY' => $data['quality'], ) ); $reagents = explode('|',$data['reagents']); //echo $name.'<br>'; if ( is_array($reagents) ) { //print_r($reagents); //echo '<pre><br>'; foreach ($reagents as $reagent) { $dtr = explode(':', $reagent); //print_r($reagent); //echo '<br>'; //echo $dtr[0].' -|- '. //print_r($reagent_arr[$dtr[0]]); //echo '<br><hr><br>'; if (empty($dtr[0])) { $roster->tpl->assign_block_vars('recipe.row.reagents',array( 'DATA' => $reagent, 'ID' => '000', 'NAME' => 'Missing', 'ITEM_COLOR' => '000000', 'QUALITY' => recipe::getQualityName('ffffff'), 'COUNT' => '0', 'ICON' => 'inv_misc_questionmark', 'TOOLTIP' => makeOverlib('Missing data','','',0,$this->data['clientLocale'],',RIGHT'), ) ); } else { $roster->tpl->assign_block_vars('recipe.row.reagents',array( 'DATA' => $reagent, 'ID' => $reagent_arr[$dtr[0]]['item_id'], 'NAME' => $reagent_arr[$dtr[0]]['item_name'], 'ITEM_COLOR' => $reagent_arr[$dtr[0]]['item_color'], 'QUALITY' => recipe::getQualityName($reagent_arr[$dtr[0]]['item_color']), 'COUNT' => $dtr[1], 'ICON' => $reagent_arr[$dtr[0]]['item_texture'], 'TOOLTIP' => makeOverlib($reagent_arr[$dtr[0]]['tooltip'],'','',0,$this->data['clientLocale'],',RIGHT'), ) ); } } } } } } */ //echo '<pre>';print_r($recipexx);echo '</pre>'; $roster->tpl->set_filenames(array('recipes' => $addon['basename'] . '/recipes.html')); return $roster->tpl->fetch('recipes'); }
//$recipes[$index][$nr]['components'] = $lines[2][4]; if (array_key_exists('0', $name[2])) { $parsedrecipes[$index][$nr]['i_link'] = $name[2][0]; } //$recipes[$index][$nr]['category'] = $lines[2][2]; $parsedrecipes[$index][$nr]['skill'] = $lines[2][3]; // preg_match('/(\<a[^\>]* href=\"([^\"]*)\"\>)([^<]*)(.*(\<a[^\>]* href=\"([^\"]*)\"\>\<span[^\>]*\>)([^<]*))?/i',$lines[2][1],$name); $parsedrecipes[$index][$nr]['r_link'] = $name[2][0]; if (isset($name[3][1])) { $parsedrecipes[$index][$nr]['pat_link'] = $name[2][1]; $parsedrecipes[$index][$nr]['pat_name'] = $name[3][1]; } } } //aprint($parsedrecipes); $known = recipe_get_many($charid, '', 'level'); // aprint($known); $all_count = array(); foreach ($known as $kindex => $krecipe) { $knownrecipenames[] = $krecipe->data['recipe_name']; } foreach ($skill_list as $sindex => $skill) { foreach ($parsedrecipes[$sindex] as $nr => $recipe) { $allrecipenames[$sindex][] = str_replace(" ", " ", $recipe['name']); } // $diffrecipenames[$sindex] = array_diff($allrecipenames[$sindex],$knownrecipenames); foreach ($allrecipenames[$sindex] as $recipekey => $recipename) { if (!in_array($recipename, $knownrecipenames)) { $diffrecipenames[$sindex][$recipekey] = $recipename; } }