Файл: sewing.php
Строк: 135
<?php
include_once("settings.php");
include_once("game_header.php");
include_once("thing.php");
include_once("player_thing.php");
include_once("chain.php");
//FIX ME
if($room_id!=1){
header("Location: area.php");
break;
}
$player_thing = new CPlayerThings($db,$vnum);
$thing = new CThing($db);
$chain = new CChain($db);
$level_tailor=$skill->getSkillLevel(SKILL_TAILOR);
if($level_tailor==false){
//add player gansmith skill
$skill->setSkill(SKILL_TAILOR);
$level_tailor=1;
}
/* type make resource */
$type_res=array();
if($room_id==1){
$type_res[]=39;//cap
$type_res[]=35;//belt
$type_res[]=37;//trousers
$type_res[]=38;//boots
$type_res[]=36;//jacket
$type_res[]=42;//cap
$type_res[]=43;//black belt
$type_res[]=47;//shtani
$type_res[]=48;//jaket armor
$type_res[]=44;//shelm
}
if(isset($mode)){
$info_msg="";
switch($mode){
case 'make':
if(isset($obj)){
$chain->setVnum($obj);
$thing->setVnum($obj);
if($chain->checkComponents($player_thing)==false){
$info_msg="х ЧБУ ОЕФ ОХЦОЩИ ЛПНРПОЕОФ";
break;
}
//check player level and level things
$things_level = $thing->getLevel();
if($things_level-5>$level_tailor){
$info_msg="чЩ ОЕ НПЦЕФЕ ЙЪЗПФПЧЙФШ ЬФХ ЧЕЭШ. чБЫ ХТПЧЕОШ УМЙЫЛПН НБМ.";
break;
}
//all ok, try make things
$chain->makeThings($player_thing);
$info_msg="чЩ ХУРЕЫОП ЙЪЗПФПЧЙМЙ ЧЕЫШ";
//update exp
$object_exp=$chain->calculateExp();
$skill->setSkill(SKILL_TAILOR,$object_exp);
}
break;
}
session_register("info_msg");
header("location: sewing.php");
exit();
}
if(isset($info_msg))
{
$smarty->assign('INFO_MSG',$info_msg);
session_unregister("info_msg");
}
//get ores in player bag
$leather=$player_thing->getAllThingsOneType("leather");
foreach($leather as $v)
{
$thing->setVnum($v['obj_id']);
$thing_name=$thing->getName();
$smarty->append("leather",array(
'VNUM' => $v['obj_id'],
'NAME' => $thing_name,
'COUNT' => $v['count']
));
}
foreach ($type_res as $v)
{
$thing->setVnum($v);
if($thing->getMake()==0) continue;
$thing_name=$thing->getName();
$thing_level=$thing->getLevel();
$chain->setVnum($v);
$component = $chain->getComponents();
if($component==false) continue;
$thing->setVnum($component['vnum_1']);
$comp1_name=$thing->getName();
$comp1_count=$component['count_1'];
if($component['count_2']!=0){
$thing->setVnum($component['vnum_2']);
$comp2_name=$thing->getName();
$comp2_count=$component['count_2'];
}else{
$comp2_name="";
$comp2_count="";
}
$smarty->append("things",array(
'VNUM' => $v,
'NAME' => $thing_name,
'LEVEL' => $thing_level,
'COMP1_NAME' => $comp1_name,
'COMP2_NAME' => $comp2_name,
'COMP1_COUNT' => $comp1_count,
'COMP2_COUNT' => $comp2_count,
));
}
$smarty->assign('LEVEL_TAILOR',$level_tailor);
$sewing_txt=$smarty->fetch($templ_path.'/sewing.tpl');
$smarty->assign('MAIN',$sewing_txt);
$smarty->display($templ_path.'/game.tpl');
?>